webassembly使用sdl的例子

osg on Web的一种实现 -- emscripten & SDL & webAssembly 0 整体参照 0.0 从(本节为第0大节)第2大节开始的所有命令要位于一个命令行内执行 0.1 参照原因:首先调查到可以使用webAssembly来完成osg on web这件事情,然后寻找资料,合适的如下: https://github.com/OGStudio/openscenegraph-cross-platform-guide/tree/master/1.10.SampleWeb 0.2 该博客目的:github上提供了具体的流程,但是具体部署过程较为复杂,而且对于一些不必要的安装不了解就会走弯路 阅读详情

sdl的例子转成webassembly的例子

注意
1.主函数改个主循环,只有这里是嵌入的代码
emscripten_set_main_loop_arg
2.用emcc生成js和wasm
3.在h5中只需要把Module对象的cavas属性和dom元素对应上即可。
4.关于memory.wasm,参考https://github.com/guybedford/wasm-stdlib-hack
和例子:https://github.com/guybedford/wasm-intro
https://github.com/3dgen/cppwasm-book

c的代码 为

#include <SDL2/SDL.h>
#include <emscripten.h>
#include <cstdlib>

struct context
{
    SDL_Renderer *renderer;
    int iteration;
};

void mainloop(void *arg)
{
    context *ctx = static_cast<context*>(arg);
    SDL_Renderer *renderer = ctx->renderer;

    // example: draw a moving rectangle

    // red background
    SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
    SDL_RenderClear(renderer);

    // moving blue rectangle
    SDL_Rect r;
    r.x = ctx->iteration % 255;
    r.y = 50;
    r.w = 50;
    r.h = 50;
    SDL_SetRenderDrawColor(renderer, 0, 0, 255, 255 );
    SDL_RenderFillRect(renderer, &r );

    SDL_RenderPresent(renderer);

    ctx->iteration++;
}

int main()
{
    SDL_Init(SDL_INIT_VIDEO);
    SDL_Window *window;
    SDL_Renderer *renderer;
    SDL_CreateWindowAndRenderer(255, 255, 0, &window, &renderer);

    context ctx;
    ctx.renderer = renderer;
    ctx.iteration = 0;

    const int simulate_infinite_loop = 1; // call the function repeatedly
    const int fps = -1; // call the function as fast as the browser wants to render (typically 60fps)
    emscripten_set_main_loop_arg(mainloop, &ctx, fps, simulate_infinite_loop);

    SDL_DestroyRenderer(renderer);
    SDL_DestroyWindow(window);
    SDL_Quit();

    return EXIT_SUCCESS;
}

编译的脚本为:

emcc core.cpp -s WASM=1 -s USE_SDL=2 -O3 -o index.js

生成index.wasm 和index.js

index.html为

<!DOCTYPE html>
<html>
<head>
   <meta charset="utf-8">
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
   <!-- Create the canvas that the C++ code will draw into -->
   <canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
   <!-- Allow the C++ to access the canvas element -->
   <script type='text/javascript'>
       var Module = {
           canvas: (function() { return document.getElementById('canvas'); })()
       };
   </script>
   <!-- Add the javascript glue code (index.js) as generated by Emscripten -->
   <script src="index.js"></script>
   <p>Minimal example of animating the HTML5 canvas from C++ using SDL through WebAssembly.</p>
</body>
</html>
WebAssembly学习(三)——初步读取本地文件 在之前的学习记录里面,已经实现了简单的hello word打印,在这一步学习如何利用SDL库打印图案以及加载文件 阅读详情

相关推荐

wasm_sdl2_test:WebAssembly + SDL2的测试

使用SDL2进行WebAssembly的小测试 播放背景音乐时,一个球在画布上弹跳。 当球击中墙壁时发出声音效果。 签出。 要求 吉特 建造 结帐项目: git clone --recursive https://github.com/AlbertVeli/wasm_sdl2_test cd wasm_sdl2_test make 在端口8080上进行本地测试 python -m SimpleHTTPServer 8080 或emrun --no_browser --port 8080 . (将--emrun添加到链接器标志以这种方式运行) 访问 资源 -Emscripten仅支持SDL_mixer1。可以与SDL2一起使用。 比这更小的例子 笔记 我只有通过将--preload-file添加到CFLAGS才能使文件加载与emscripten一起使用。 反过来,这仅适用于_

Emscripten运行main和Emscripten_set_main_loop

一、main()函数与生命周期 对于Emscripten来说,main()函数既不是必需的,也不控制运行时生命周期。 1、test.c #include <stdio.h> #include <emscripten.h> //extern "C" { EMSCRIPTEN_KEEPALIVE int show_answer() { return 42; } int main() { printf("hello world\n"); return 1; } //}

qq_34754747的博客 1699

sdl-to-wasm-games:用C和SDL构建的游戏编译到WebAssembly

sdl-to-wasm游戏 使用C和SDL构建的游戏的编译,该游戏通过编译为WebAssembly。 游戏类 目前,仅添加了两个游戏:Snake和Asteroids。 这两款游戏均使用C和SDL编写,并通过Emscripten编译为WebAssembly。 预告片 蛇: : 如何? 我写了一篇文章,介绍如何轻松地使这些游戏在网络浏览器中运行,

WebAssembly 游戏开发实用指南(一)

WebAssembly 是一项将在未来几年改变网络的技术。WebAssembly 承诺了一个世界,网络应用程序以接近本机速度运行。这是一个你可以用任何喜欢的语言为网络编写应用程序,并将其编译为本机平台以及网络的世界。对于 WebAssembly 来说,现在还处于早期阶段,但这项技术已经像火箭一样起飞。如果你对网络的未来和现在一样感兴趣,那就继续阅读吧!我写这本书是为了反映我喜欢学习新技能的方式。我将带领你通过使用 WebAssembly 及其所有相关技术开发游戏。

龙哥盟 1652

WasmGame:使用WASM模块的进行中实验,以向游戏中添加组件

WasmGame:使用WASM模块的进行中实验,以向游戏中添加组件

wasm-sdl-tinkering

wasm-sdl-tinkering 快速回购可与WASM和SDL2一起玩 安装 脚本 要使用emscripten进行编译,(将其安装在 ),然后在根文件夹中运行它 ./compile_emscripten.sh C ++ 与C ++一起运行 通过github安装vcpkg ./vcpkg integrate install ./vcpkg install sdl2 sdl2-image 将env设置为您安装VCPKG的任何位置 VCPKG_ROOT= 或者使用example.settings.json指定vcpkg cmake工具链文件(如果您在cmake:configure之后不小心这样做了,则必须运行cleanup.sh并再次运行) 使用建议的vs代码扩展来通过cmake运行(Shift + CMD + P“ Cmake:配置”) 要在本地清除临时文件,请运行此命令

200ms卡顿终结术:ImGui+SDL的WebAssembly极速移植

你是否还在忍受Web图形应用的200ms卡顿?当用户点击按钮后,界面像迟滞的潮水般缓慢响应——这不仅影响体验,更是Web应用走向专业领域的致命瓶颈。本文将带你用WebAssembly技术重构ImGui与SDL应用,实现桌面级流畅度的浏览器体验。读完本文,你将掌握: - 3步完成SDL+ImGui项目的WebAssembly化 - 突破浏览器性能限制的5个关键优化点 - 移植前后的性能对比与实测数据...

gitblog_00412的博客 921

web无插件解码播放H264(WebAssembly)

基于网上找到的实例源码,因这个代码所配套的支持开源库版本或者其他原因无法编译通过只能自己按照实例描述的流程重新生成所需的支持库,经过1天努力终于在linux环境中复现了 H264播放功能 现在分享出来。 大致实现步骤: 1. 编译x264并安装。 2. 编译SDL2-2.0.16并安装。 3. 编译ffmpeg并安装。 4. cmake / make 编译server目录下工程。 5. server/build/目录下启动 simple_web_server。 6. web-client 目录下文件放置到 emcc 环境用 emrun 启动8080侦听端口。 7. web游览器内输入 http://localhost:8080/index.html 并点击 play 按钮即可播放视频。

webassembly002 whisper.wasm wasm_eval 与js代码交互 EMSCRIPTEN_BINDINGS,Module

Module 是 Emscripten 的一个全局对象,用于在 JavaScript 环境中管理与编译后的 WebAssembly 模块交互的相关设置和功能。 方法/属性 描述 示例代码 在控制台打印信息。通常用于在 C/C++ 代码中输出调试信息,然后在浏览器控制台查看。 在错误控制台打印信息。与 类似,但用于打印错误信息。 设置状态信息。通常用于在页面上更新状态信息。 一个回调函数,当 WebAssembly 模块初始化完成时被调用。你可以为这个属性设置

ResumeProject的博客 1660

C# 原生数字孪生的尝试

本文介绍了使用C#实现数字孪生的基本思路。首先从爱普生官网下载机器人3D模型,然后通过Blender创建并导出带动画的FBX模型。在WPF项目中,使用HelixToolkit.SharpDX等插件加载模型,通过Viewport3DX进行3D渲染。关键点是通过动画控制器接收真实设备信号来驱动模型动画,实现物理实体与虚拟模型的同步。文中提供了完整的代码实现,包括模型导入、动画播放控制等核心功能。该方法为构建数字孪生系统提供了一种可行的技术方案。

qq_33529095的博客 1329

YOLOv8知识蒸馏实战:用BCKD和LD在自制数据集上分别提点1.63%和1.69%的保姆级教程

本文详细介绍了在YOLOv8模型上应用知识蒸馏技术(BCKD和LD方法)的实战教程,通过自制数据集实现性能提升1.63%和1.69%。内容涵盖环境配置、模型选择、BCKD和LD的具体实现及调参技巧,适合目标检测领域的开发者和研究者。

weixin_29082143的博客 245

wasm-canvas 项目使用教程

wasm-canvas 项目使用教程 1. 项目介绍 wasm-canvas 是一个 C99 兼容的抽象层,用于与 HTML Canvas API 进行交互。该库旨在用于通过 Emscripten 编译为 WebAssembly 的项目中。其主要目的是通过 WebAssembly 在画布上绘制一系列图像,以实现更快的速度和更高的内存效率。 2. 项目快速启动 2.1 环境准备 在开始之前,请确保你...

gitblog_00184的博客 804

双参数威布尔分布(Weibull分布)参数计算(根据故障数据,求双参数威布尔分布的参数详细步骤)

根据故障数据求威布尔分布参数步骤 根据众多文献研究,设备故障数据大多服从指数分布、威布尔分布或对数正态分布。其中威布尔分布较为常用,本文主要介绍威布尔分布的简单应用,并根据某设备故障数据为例简单介绍威布尔分布参数的计算方法。 参考文献11参考文献22 1.双参数威布尔分布的概率密度函数、概率分布函数、可靠度函数: 2.预处理故障数据 将故障数据按时间排序,假设设备分别在以下时间点失效:11.1 、23.5、58.4……则将此时间从小到大排序。并计算中位秩。中位秩的计算公式如下: 其中i表示第几个数据,n

biaochengxiaobai的博客 4万+

如何部署一个生产级 WebAssembly 模块

WebAssembly(WASM)作为一种高性能的字节码格式,为 Web 开发带来了接近原生的执行速度,广泛应用于图像处理、游戏开发和科学计算等领域。然而,将 WASM 模块从开发到生产部署需要系统性的构建、调试和优化策略。本文全面指导如何打造生产级 WASM 模块,涵盖构建工具链选择(Emscripten vs. wasm-pack)、Webpack 和 Vite 的打包配置、Chrome DevTools 的调试技巧、CDN 加载的 CORS 处理,以及实际部署中的常见问题与解决方案。通过详细的代码示例

zimin的专栏 1666

《计算机网络》复试问答题总结

DNS 是一个联机分布式数据库系统,负责主机名和 IP 地址之间的转换,需要进行域名查询的机器主动发起域名解析请求,域名服务器则随时准备做出响应。域名服务器的数据库中存放着它所管辖范围的主机名和 IP 地址之间的映射表,域名服务器之间又可以相互联络和协作,以便分布在 Internet 各个域名服务器数据库中的域名都能被有效地搜索,从而实现主机名与 IP 地址的映射。为了提高解析效率,使用了域名缓存技术。在服务器、主机中设置一个专用的内存缓冲区。服务器用来存放近期解析过的域名及其对应的 IP 地址的映射。

weixin_45971154的博客 2027

汇川EASY系列之以太网通讯(套接字socket做主站)

本文讲解汇川Easy系列使用以太网套接字socket通讯,本例中EasyPLC做主站。文中按步进行操作。细节明确。

这是一个长期关注工控行业技术的博客,实现0-1的突破,期待您的关注和留言 2189

WebAssembly Studio:Mozilla 提供的 WASM 工具

WebAssembly Studio是 Mozilla 开发的一款在线工具,用于将 C/C++ 和 Rust 代码编译为 WASM 格式。 WebAssembly Studio 是 Mozilla 在数月前通过合并WasmExplorer和WasmFiddle项目而推出的一个新项目。Mozilla 并非计划通过在 IDE 上另起炉灶,以替代那些当前得到广泛采用的 IDE,而是意在将对 WebAs...

p312011150的博客 2506

恒玄BES调试笔记-BES2500如何Dump Anc Audio数据

从YP的4M flash改HP3的2M flash只需要改: 原工程:target.mk的export FLASH_SIZE ?= 0x200000和common.mk里的KBUILD_CPPFLAGS += -DNEW_IMAGE_FLASH_OFFSET=0x100000 OTA工程:target.mk的NEW_IMAGE_FLASH_OFFSET ?= 0x100000和FLASH_SIZE ?= 0x200000 ...

leezs的博客 1671

Boytacean性能优化指南:从SDL到WebAssembly的跨平台加速

Boytacean是一款用Rust编写的Game Boy和Game Boy Color模拟器,以高性能和跨平台兼容性为核心优势。本文将深入探讨其从SDL到WebAssembly的全栈性能优化策略,帮助开发者和用户充分发挥这款模拟器的潜力。 ## 🚀 性能基准:Boytacean的速度优势 Boytacean在性能上表现出色,尤其在DMG模式下展现了显著优势。根据[doc/performanc

gitblog_01136的博客 459

第12篇:TMC2240 CoolStep节能功能|软件配置+功耗测试(保姆级)

本文介绍了TMC2240驱动芯片的CoolStep节能功能,通过动态调节电机电流实现功耗优化。CoolStep利用StallGuard技术实时检测负载,自动调整运行电流,空载时可降低50%以上功耗。文章详细讲解了节能原理、寄存器配置方法和参数校准步骤,提供可直接复用的STM32代码。该功能特别适合电池供电设备,能显著延长续航时间,同时保持电机性能稳定。配置时需注意SG阈值、电流步长等关键参数,并可与静音模式叠加使用。

BackCatK Chen的博客 918

HLA分型

HLA分型 一、根据WES的tumor数据进行数据分型 选用hlahd 软件安装及使用 [root@18605fd8771e ~]# wget https://jaist.dl.sourceforge.net/project/bowtie-bio/bowtie2/2.4.1/bowtie2-2.4.1-linux-x86_64.zip [root@18605fd8771e ~]# unzip bowtie2-2.4.1-linux-x86_64.zip && mv bowtie2-2.4.1

qq_23435961的博客 2487

Agnitra AI 对接 NVIDIA 生态指南:TensorRT-LLM 后端、NIM 打包与 Triton 部署快速上手

Agnitra AI 是面向生产级 LLM 推理的优化与信任层,一行 `agnitra.optimize()` 即可完成量化优化并生成加密签名清单。对于 NVIDIA 用户,它把 TensorRT-LLM 后端包装、NIM 容器打包与 Triton Inference Server 部署压缩成"一个 Python 关键词 + 一条 CLI 命令",无需手写 C++ 或 CUDA 工程。本指南带你走

gitblog_00539的博客 473

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

Webassembly 学习手册(二)

原文:annas-archive.org/md5/d5832e9a9d99a1607969f42f55873dd5 译者:飞龙 协议:CC BY-NC-SA 4.0 第五章:创建和加载 WebAssembly 模块 我们在第四章 安装所需的依赖项中向emcc命令传递的标志产生了一个单一的.wasm文件,可以使用本机的WebAssembly对象在浏览器中加载和实例化。C 代码是一个非常简单的示例,旨在测试编译器,而无需考虑包含的库或 WebAssembly 的限制。通过利用 Emscripten 的一些功

龙哥盟 1366

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

webassembly_sdl(opengl)_imgui_cmake

wasm_sdl_imgui_cmake 0.source schteppe/imgui-wasm: imgui/wasm boilerplate (github.com) https://github.com/ActivePeter/paTempletes/tree/main/wasm_sdl_imgui_cmake 1.development 1.0 make sure you have required softs/environments 确保你安装了必要的软件和环境 vscode, Emscrip

hanbaoaaa的博客 784

WebAssembly Studio:Mozilla提供的WASM工具

\u0026#xD;看新闻很累?看技术新闻更累?试试下载InfoQ手机客户端,每天上下班路上听新闻,有趣还有料!\u0026#xD;\u0026#xD;\u0026#xD;WebAssembly Studio是Mozilla开发的一款在线工具,用于将C/C++和Rust代码编译为WASM格式。\u0026#xD;\u0026#xD;WebAssembly Studio是Mozilla在数月前通过合...

cpongo011702 162
上一篇: 多个wasm之间的交互
下一篇: wasm编译mame游戏到h5中
linux内核控
博客等级 码龄19年 41粉丝 638原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值