You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding the script tag provided on the cdnjs website to the HEAD of your HTML file, you can use js-pytorch in any script tag inside your file.
This image serves as an example.
If it's still not working, please let me know!
Thanks Eduardo,
I actually meant the system to build the "js-pytorch-browser.js" file... I was able to get it working using rollup. Here was config I used "rollup.config.js" in case you ever want to integrate a build system for web... (I also I had to move the other.gpu = new GPU(); dependency out of tensor.ts) :
import typescript from '@rollup/plugin-typescript';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import polyfillNode from 'rollup-plugin-polyfill-node'; // Use this if you need to polyfill Node modules
export default {
input: 'src/index.ts',
output: {
file: 'dist/js-pytorch-browser.js',
format: 'iife', // Change to appropriate format if needed (e.g., umd)
name: 'JsPytorch',
globals: {
fs: 'null' // Ensures fs is treated as null in the browser
}
},
plugins: [
resolve({
browser: true,
preferBuiltins: false // Important for resolving Node modules to browser versions
}),
commonjs(),
typescript(),
// Uncomment if you need to polyfill Node built-ins:
// polyfillNode()
]
};
Describe the Feature
Trying to develop some new features but very difficult to get build for browser working to you have rollup or webpack config that you used available?
Motivation [optional]
No response
Sample Code
No response
Would you like to work on this issue?
None
The text was updated successfully, but these errors were encountered: