Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Created January 3, 2025 22:45
Show Gist options
  • Save kenwebb/d78d782b168c1ed5f7d52727e9031af0 to your computer and use it in GitHub Desktop.
Save kenwebb/d78d782b168c1ed5f7d52727e9031af0 to your computer and use it in GitHub Desktop.
Tensors and TensorFlow.js
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Fri Jan 03 2025 17:44:33 GMT-0500 (Eastern Standard Time)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Tensors and TensorFlow.js
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName:
Keywords:
My Notes
--------
3 Jan 2024
Experiment with TensorFlow.js tensors
### References
(1) https://www.tensorflow.org/js
TensorFlow.js is a library for machine learning in JavaScript
Develop ML models in JavaScript, and use ML directly in the browser or in Node.js.
) https://www.tensorflow.org/js/tutorials
(2) https://www.youtube.com/watch?v=WLtkPIrCs9Y
TensorFlow fundamentals: What are tensors in TensorFlow.js?
Google for Developers, 2.41M subscribers
9,344 views Jan 11, 2023 Machine Learning for Web Developers (Web ML)
Learn all about Tensor fundamentals in this video before you learn how to use raw TensorFlow.js models.
TensorFlow is after all named after it, so as you may have guessed, it is pretty key to the subject.
Learn about Tensor dimensionality, rank, shape, size, axis and more to get confident using them later in the course.
this is part of a course series
(3) https://github.com/tensorflow/tfjs
(4)
]]></Notes>
<_-.XholonClass>
<!-- domain objects -->
<PhysicalSystem/>
<Block/>
<Brick/>
<!-- quantities -->
<Height superClass="Quantity"/>
</_-.XholonClass>
<xholonClassDetails>
<Block>
<port name="height" connector="Height"/>
</Block>
</xholonClassDetails>
<PhysicalSystem>
<Block>
<Height>0.1 m</Height>
</Block>
<Brick multiplicity="2"/>
</PhysicalSystem>
<Blockbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var a = 123;
var b = 456;
var c = a * b;
if (console) {
console.log(c);
}
//# sourceURL=Blockbehavior.js
]]></Blockbehavior>
<Heightbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var myHeight, testing;
var beh = {
postConfigure: function() {
testing = Math.floor(Math.random() * 10);
myHeight = this.cnode.parent();
},
act: function() {
myHeight.println(this.toString());
},
toString: function() {
return "testing:" + testing;
}
}
//# sourceURL=Heightbehavior.js
]]></Heightbehavior>
<Brickbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
$wnd.xh.Brickbehavior = function Brickbehavior() {}
$wnd.xh.Brickbehavior.prototype.postConfigure = function() {
this.brick = this.cnode.parent();
this.iam = " red brick";
};
$wnd.xh.Brickbehavior.prototype.act = function() {
this.brick.println("I am a" + this.iam);
};
//# sourceURL=Brickbehavior.js
]]></Brickbehavior>
<Brickbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
console.log("I'm another brick behavior");
]]></Brickbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Block</title>
<rect id="PhysicalSystem/Block" fill="#98FB98" height="50" width="50" x="25" y="0"/>
<g>
<title>Height</title>
<rect id="PhysicalSystem/Block/Height" fill="#6AB06A" height="50" width="10" x="80" y="0"/>
</g>
</g>
</svg>
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient>
</XholonWorkbook>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment