tapewasm 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tapewasm",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Compile an autodiff tape to a WebAssembly module and sample it with nuts-rs, in the browser.",
5
5
  "type": "module",
6
6
  "main": "./index.js",
package/pkg/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "tapewasm",
3
3
  "type": "module",
4
4
  "description": "Compile an autodiff tape to a wasm module and sample it with nuts-rs, in the browser. The wasm-bindgen API over tapewasm-codegen.",
5
- "version": "0.3.4",
5
+ "version": "0.3.5",
6
6
  "license": "MIT OR Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
package/pkg/tapewasm.d.ts CHANGED
@@ -116,6 +116,13 @@ export class AotSampler {
116
116
  * posteriors; see [`nuts_settings`].
117
117
  */
118
118
  setGradBasedEstimate(on: boolean): void;
119
+ /**
120
+ * Keep each trajectory below `2^depth` leapfrog steps instead of nuts-rs's
121
+ * 2^10. Lower bounds the gradients per draw at the risk of stopping before
122
+ * the trajectory turns, which the draws' `numSteps` then show as a flat top.
123
+ * A number rather than a `u32`, which JS would wrap (-1) or truncate (2.7).
124
+ */
125
+ setMaxDepth(depth: number): void;
119
126
  /**
120
127
  * Aim warmup's step-size adaptation at this acceptance rate instead of
121
128
  * nuts-rs's 0.8. Higher adapts a smaller step: fewer divergences on a hard
@@ -259,6 +266,7 @@ export interface InitOutput {
259
266
  readonly aotsampler_sample: (a: number, b: number, c: number, d: number, e: number, f: bigint) => [number, number, number, number];
260
267
  readonly aotsampler_sampleWithStats: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number) => [number, number, number];
261
268
  readonly aotsampler_setGradBasedEstimate: (a: number, b: number) => void;
269
+ readonly aotsampler_setMaxDepth: (a: number, b: number) => [number, number];
262
270
  readonly aotsampler_setTargetAccept: (a: number, b: number) => [number, number];
263
271
  readonly clearAotExports: () => void;
264
272
  readonly compileTape: (a: number, b: number, c: number, d: number) => [number, number, number];
package/pkg/tapewasm.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /* @ts-self-types="./tapewasm.d.ts" */
2
- import { aot_evaluate, aot_logp } from './snippets/tapewasm-a36239fb19e3c5d4/js/aot_bridge.js';
3
- import * as import1 from "./snippets/tapewasm-a36239fb19e3c5d4/js/aot_bridge.js"
4
- import * as import2 from "./snippets/tapewasm-a36239fb19e3c5d4/js/aot_bridge.js"
5
- import * as import3 from "./snippets/tapewasm-a36239fb19e3c5d4/js/aot_bridge.js"
6
- import * as import4 from "./snippets/tapewasm-a36239fb19e3c5d4/js/aot_bridge.js"
7
- import * as import5 from "./snippets/tapewasm-a36239fb19e3c5d4/js/aot_bridge.js"
2
+ import { aot_evaluate, aot_logp } from './snippets/tapewasm-8f332cef44599c8c/js/aot_bridge.js';
3
+ import * as import1 from "./snippets/tapewasm-8f332cef44599c8c/js/aot_bridge.js"
4
+ import * as import2 from "./snippets/tapewasm-8f332cef44599c8c/js/aot_bridge.js"
5
+ import * as import3 from "./snippets/tapewasm-8f332cef44599c8c/js/aot_bridge.js"
6
+ import * as import4 from "./snippets/tapewasm-8f332cef44599c8c/js/aot_bridge.js"
7
+ import * as import5 from "./snippets/tapewasm-8f332cef44599c8c/js/aot_bridge.js"
8
8
 
9
9
 
10
10
  /**
@@ -273,6 +273,19 @@ export class AotSampler {
273
273
  setGradBasedEstimate(on) {
274
274
  wasm.aotsampler_setGradBasedEstimate(this.__wbg_ptr, on);
275
275
  }
276
+ /**
277
+ * Keep each trajectory below `2^depth` leapfrog steps instead of nuts-rs's
278
+ * 2^10. Lower bounds the gradients per draw at the risk of stopping before
279
+ * the trajectory turns, which the draws' `numSteps` then show as a flat top.
280
+ * A number rather than a `u32`, which JS would wrap (-1) or truncate (2.7).
281
+ * @param {number} depth
282
+ */
283
+ setMaxDepth(depth) {
284
+ const ret = wasm.aotsampler_setMaxDepth(this.__wbg_ptr, depth);
285
+ if (ret[1]) {
286
+ throw takeFromExternrefTable0(ret[0]);
287
+ }
288
+ }
276
289
  /**
277
290
  * Aim warmup's step-size adaptation at this acceptance rate instead of
278
291
  * nuts-rs's 0.8. Higher adapts a smaller step: fewer divergences on a hard
@@ -563,15 +576,15 @@ function __wbg_get_imports() {
563
576
  __wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
564
577
  throw new Error(getStringFromWasm0(arg0, arg1));
565
578
  },
566
- __wbg_aot_evaluate_85ed206dc7e5ceef: function() { return handleError(function (arg0, arg1, arg2, arg3) {
579
+ __wbg_aot_evaluate_59e3797ad39ed69a: function() { return handleError(function (arg0, arg1, arg2, arg3) {
567
580
  const ret = aot_evaluate(arg0 >>> 0, arg1 >>> 0, arg2 >>> 0, arg3 >>> 0);
568
581
  return ret;
569
582
  }, arguments); },
570
- __wbg_aot_logp_845ba7cb025408ad: function(arg0, arg1, arg2, arg3) {
583
+ __wbg_aot_logp_05b8eff6985b4538: function(arg0, arg1, arg2, arg3) {
571
584
  const ret = aot_logp(arg0 >>> 0, arg1 >>> 0, arg2 >>> 0, arg3 >>> 0);
572
585
  return ret;
573
586
  },
574
- __wbg_call_81c6c30636ec594e: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
587
+ __wbg_call_e22c9e5bbebdaf41: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
575
588
  var v0 = getArrayF64FromWasm0(arg3, arg4).slice();
576
589
  wasm.__wbindgen_free(arg3, arg4 * 8, 8);
577
590
  var v1 = getArrayF64FromWasm0(arg5, arg6).slice();
@@ -614,11 +627,11 @@ function __wbg_get_imports() {
614
627
  return {
615
628
  __proto__: null,
616
629
  "./tapewasm_bg.js": import0,
617
- "./snippets/tapewasm-a36239fb19e3c5d4/js/aot_bridge.js": import1,
618
- "./snippets/tapewasm-a36239fb19e3c5d4/js/aot_bridge.js": import2,
619
- "./snippets/tapewasm-a36239fb19e3c5d4/js/aot_bridge.js": import3,
620
- "./snippets/tapewasm-a36239fb19e3c5d4/js/aot_bridge.js": import4,
621
- "./snippets/tapewasm-a36239fb19e3c5d4/js/aot_bridge.js": import5,
630
+ "./snippets/tapewasm-8f332cef44599c8c/js/aot_bridge.js": import1,
631
+ "./snippets/tapewasm-8f332cef44599c8c/js/aot_bridge.js": import2,
632
+ "./snippets/tapewasm-8f332cef44599c8c/js/aot_bridge.js": import3,
633
+ "./snippets/tapewasm-8f332cef44599c8c/js/aot_bridge.js": import4,
634
+ "./snippets/tapewasm-8f332cef44599c8c/js/aot_bridge.js": import5,
622
635
  };
623
636
  }
624
637
 
Binary file
@@ -18,6 +18,7 @@ export const aotsampler_new: (a: number, b: number, c: number, d: number, e: num
18
18
  export const aotsampler_sample: (a: number, b: number, c: number, d: number, e: number, f: bigint) => [number, number, number, number];
19
19
  export const aotsampler_sampleWithStats: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number) => [number, number, number];
20
20
  export const aotsampler_setGradBasedEstimate: (a: number, b: number) => void;
21
+ export const aotsampler_setMaxDepth: (a: number, b: number) => [number, number];
21
22
  export const aotsampler_setTargetAccept: (a: number, b: number) => [number, number];
22
23
  export const clearAotExports: () => void;
23
24
  export const compileTape: (a: number, b: number, c: number, d: number) => [number, number, number];