Andrew Kaiser

Results 147 comments of Andrew Kaiser

heres a slightly stranger option that would reduce the boilerplate but would require the use of a `Proxy` on the client. [typescript playground](https://www.typescriptlang.org/play/?ts=3.5.1&ssl=20&ssc=7&pln=20&pc=16#code/C4TwDgpgBAggTgcwK4FsIDtgBVwQM4A8AYlBAB7AYAmeURS6AxsAJYD26AfFALx2kVqtABQA6cQENEeAFxQW6AGYQ4sAJS9uE9CCgB+WFDnoIANxUAoUJChYAFhngICWbnywDK6GlAAKcNhQWPAgCBWVVAFVuA0ijWwsrXCgAEQhFBRZWDjwAcQwVFkZeKABvKABtRQA5CTQ5PGA4BQQAXTlhOAgARyR8YDltEA0eLR0oAF8kmwBZCQBrCAAlfDYAG3M4QgBJTyFU9Mzs9DyC5sY3MosoSoBpeXQoRZA2RSht9qhOnr7GuSdUBhsLgdhVbq1OBUAAytEbcfyBYKhFbAJBwdA4SAEbZgiGcCxTabQNIZdBZdjoADCHCaEmYJXKVXQtXqUEazXQbTk5S6vX6gx0AG4oF08GAchABboJpMiVA5osSUcKdTMHA6cBsXtvLQlWTjqcTOdLqVrncHk8IC83h9uWabrzfgNYIhAZhMfhsbjITD7SL8OKTpLbA50E4CCi0RjcF7wZx8TcpoTrNAFctVhsVHgiAEUKracwteQvD49eSOPn1cwTWawRbnq93p9vny-u9cRUAOSO-qd2GaPy5pGx1pd0WBkJ9-FTRg5YBQRhdCSUJZgRiUtYsIElFza0uHfUUw2FC6dNcAeTABu5Mr4pQmajkaZWeHWm0IrgHpodEFR6KgJgAO6DmwZAgMI94ADRXDcNwIL+whsAARgAVtBzwaN+sE3AA9Dhlq6DwRFQPBwAABIQGsaxsNBLxIAu2j+khSAsGsVBQBIIprlAaB4HgEjwVADhdH6UyJhoEi0EMBKJCmUAUVRbBlgaDJmqRCnUR0PZtuUazaMgAnBuyLSTHCZRQJQFANE0JlJoks4nPOdjaFQaxZk+Czpq+mZbAQGlKQe5YnDWcG-v5gx4CATBfLp+lIIZplfn6LBvMIemcvFglEXwnZitowR2J2GhdH+jzlJZzqdmR6wSJ2srYZRIQWXYATAUBUAAKJwAEcDCAABulBmCQAJKUg2ZRAMroGw86KGwDBUKIfVqGadkOY0C6btufCLhAy7LGuG5bpgfmUdRylHpwwgrXhUBsPMFiMFtmCiOpZ1sBBUDjYZci5XVD4WLdckqD1j3PcAr1he9n3ffBcgAEwAIymRYQA)

Ah fair enough, I had not considered the annoyances of tree shaking. The third example (using a `Proxy`) could still make it more clear by defining a type only interface,...

@lishine I actually have a full working implementation of what I described, but unfortunately I am waiting for it to be cleared with my company before I opens source it....

I dont want to hijack this thread too much since we're getting off topic but I will try to answer concisely: > You meant W/O proxy? the solution I built...

that prints ``` false false ``` I may be able to get away with the browser platform if I can somehow force that. Deno implements most browser apis. Is it...

yeah so looking at the browser_platform.ts file, this should function fine in deno, if we can force it https://github.com/tensorflow/tfjs/blob/master/tfjs-core/src/platforms/platform_browser.ts. IndexedDB is not implemented in deno, but that appears to be...

Ok I see. Here it is https://github.com/tensorflow/tfjs/blob/a1e5aeabc24271ac4f9eefb434b2e6076367693a/tfjs-core/src/device_util.ts#L60. It is because of `window.document != null`. In deno, `window.document` is `undefined`. So actually, I think this could be possibly be solved by...

I guess what I am describing is "duck typing", which to a degree, is what you already are checking. You have a check that is essentially: if it looks like...

@haoyunfeix I tried out your example and was able to at least get tensorflowjs to register the platform as deno. Going one step further to estimate a pose however, yields...

thanks @haoyunfeix, I did a `--reload` and see the same error as you now. Curious though that `await tf.setBackend('webgpu') logs an exception, but does not throw it