generated from foambubble/foam-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
214 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>Hello World - TensorFlow.js</title> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<!-- Import the webpage's stylesheet --> | ||
<link rel="stylesheet" href="/style.css"> | ||
</head> | ||
<body> | ||
<h1>TensorFlow.js Hello World</h1> | ||
|
||
<p id="status">Awaiting TF.js load</p> | ||
|
||
<!-- Import TensorFlow.js library --> | ||
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js" type="text/javascript"></script> | ||
|
||
<!-- Import the page's JavaScript to do some stuff --> | ||
<script src="/script.js" defer></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 Google LLC. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* ============================================================================= | ||
*/ | ||
|
||
const status = document.getElementById('status'); | ||
status.innerText = 'Loaded TensorFlow.js - version: ' + tf.version.tfjs; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 Google LLC. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* ============================================================================= | ||
*/ | ||
|
||
/* CSS files add styling rules to your content */ | ||
|
||
body { | ||
font-family: helvetica, arial, sans-serif; | ||
margin: 2em; | ||
} | ||
|
||
h1 { | ||
font-style: italic; | ||
color: #FF6F00; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Tensor | ||
|
||
## What | ||
* Primary data structure in tensorflow models | ||
* Similar to arrays that can have multiple dimensions. **ONLY contain numerical data** | ||
* ML models take tensors as inputs and output tensors | ||
* Tensor is a class | ||
* Need to explicitly dispose tensors when they are no longer needed | ||
* tf.dispose() => to destroy a specific tensor | ||
* tf.tidy() => dispose any tensor(s) created in the same function | ||
* Terminology: | ||
* DataType (DType) => either integer or floating point | ||
* Shape => Number of elements present along each axis of the tensor (a cube would have a shape of [3,3,3] if it had 3 elements on each axis) | ||
* Rank => # of "Axis" in the tensor. 6 Axis is max number tensorflow handles | ||
* Size => total elements in the tensor | ||
* Example: | ||
* 0 Dimensions: | ||
``` | ||
// js 0 dimension | ||
let value = 6; | ||
|
||
// tf 0 dimension | ||
let tensor = tf.scalar(6); | ||
``` | ||
* 1 Dimensional: example as a x,y,x coordinates on a 3 dimensional plane | ||
``` | ||
// js 1 dimension | ||
let value = [1,2,3]; | ||
// tf 1 dimension. | ||
let tensor = tf.tensor1d([1,2,3]); | ||
``` | ||
* 2 Dimensional: example grayscale image | ||
``` | ||
// js 2 dimension | ||
let values = [ | ||
[1,2,3], | ||
[4,5,6], | ||
[7,8,9] | ||
] | ||
// tf 2 dimensional | ||
let tensor = tf.tensor2d([ | ||
[1,2,3], | ||
[4,5,6], | ||
[7,8,9] | ||
]); | ||
``` | ||
* 3 Dimensiona: exmaple rgb image where each pixel would need a rgb array value | ||
* 4 Dimensional: example video where the rgb images above now have a time component associated with it | ||
## Code | ||
``` | ||
/** | ||
* Line below creates a 2D tensor. | ||
* Printing its values at this stage would give you: | ||
* Rank: 2, shape: [2,3], values: [[1, 2, 3], [4, 5, 6]] | ||
**/ | ||
let tensor = tf.tensor2d([[1, 2, 3], [4, 5 ,6]]); | ||
|
||
// Create a Tensor holding a single scalar value: | ||
let scalar = tf.scalar(2); | ||
|
||
// Multiply all values in tensor by the scalar value 2. | ||
let newTensor = tensor.mul(scalar); | ||
|
||
// Values of newTensor would be: [[2, 4, 6], [8, 10 ,12]] | ||
newTensor.print(); | ||
|
||
// You can even change the shape of the Tensor. | ||
// This would convert the 2D tensor to a 1D version with | ||
// 6 elements instead of a 2D 2 by 3 shape. | ||
let reshaped = tensor.reshape([6]); | ||
``` | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
# Tensorflow | ||
|
||
## What? | ||
JS and Python library to develop models, train them, and use them to run ML and AI on many platforms. It is written in C++ | ||
|
||
## Common Terms | ||
* Deep Learning results feed better Machine Learning Models. Better Machine Learning Models feed better AI. | ||
* AI - Science of making things smart | ||
|
@@ -27,7 +24,8 @@ JS and Python library to develop models, train them, and use them to run ML and | |
* This works by feeding the Kerans Model the Layers API. The Core/OPS API then translates the Keras Model to a TensorFlow SavedModel. | ||
|
||
## What is it | ||
TensorflowJS - Javascript library that contains Google's machine learning library | ||
* JS and Python library to develop models, train them, and use them to run ML and AI on many platforms. It is written in C++ | ||
* TensorflowJS - Javascript library that contains Google's machine learning library | ||
* Python vs Javascript | ||
* Running Tensorflow in NodeJS allows you to leverage CUDA and AVX acceleration to perform a LOT faster than Python. | ||
* NodeJS supports integrating with Python Keras and Tensorflow SavedModels created in Python. | ||
|
@@ -44,6 +42,18 @@ TensorflowJS - Javascript library that contains Google's machine learning librar | |
* Interactivity - can directly interact with the library using the browser platform | ||
* Reach & Scale - Running on a browser is basically omnipresent. | ||
|
||
## Setup | ||
**Note:** If using typescript, then set "skipLibCheck: true" in tsconfig.json file. | ||
**Note:** NPM is shipped with ES Modules and ES2017 syntax | ||
* JS | ||
* npm install @tensorflow/tfjs | ||
* Node: | ||
* npm install @tensorflow/tfjs-node | ||
* Linux with CUDA support (NVIDIA GPU) | ||
* npm install @tensorflow/tfjs-node-gpu | ||
* Script tag | ||
* <script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js"></script> | ||
|
||
## Structurte | ||
Models --> Layers API --> Core/OPS API | ||
* Layers API - high level api | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Twistlock | ||
|
||
## Background | ||
When using containers, there are three primary challenges that need to be solved to ensure that your deployment is secure: | ||
1) Access Control - Ensuring that each container follows least-access privelage | ||
2) Inter-Container Communication - Ensuring that communication between containers is secure (authenticated) | ||
3) App within Container - Ensuring that code within your container doesnt violate key security, that exceptions are handled properly, or contain malicious code | ||
|
||
Twistlock is a full suite of tools to address those challenges. | ||
|
||
On VA Notify, Twistlock is used to address challenge #3; container scanning. | ||
|
||
## How | ||
Twistlock is integrated into our CI/CD pipeline. When a developer commits their code to the notify repository, Github triggers a pre-commit hook that launches Twistlock in a github VM environment. Twistlock then does a scan of the user's commit and the resultant container. If no issues are found and the container score is above a specified threshold, then the code is committed and Github kicks off any post commit actions. If there ARE issues found, then the commit is rejected and the dev is notified that an error was found. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Typescript | ||
|
||
## Common Commands: | ||
* Setup a typescript project using [GTS](https://github.com/google/gts) | ||
* creates a code formatter, linter, and code fixer for typescript projects. | ||
* npx gts init | ||
* command to compile: npm run compile | ||
* command to lin | ||
* Compile to JS | ||
* npx tsc index.ts | ||
* Activate watch command | ||
* npx tsc -w |