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
{ | |
"dependencies": { | |
"@types/jest": "^27.0.3", | |
"@types/node": "^17.0.0", | |
"@types/react": "^17.0.37", | |
"@types/react-dom": "^17.0.11", | |
"typescript": "^4.5.4", | |
... | |
}, | |
"scripts": { |
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 workflow will build 'client' folder, test and deploy to github pages on branch gh-pages | |
# For more information see: | |
# - https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
# - https://github.com/marketplace/actions/deploy-to-github-pages | |
name: Build and Deploy Frontend | |
on: | |
push: | |
branches: [ main ] |
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
# Version: 2.4.1 | |
import tensorflow as tf | |
class MaliciousModule(tf.keras.Model): | |
def __init__(self): | |
super(MaliciousModule, self).__init__() | |
self.dense = tf.keras.layers.Dense(1, activation='sigmoid') | |
@tf.function |
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
def combined_loss(gan_model, **kwargs): | |
"""Wrapper function for combine adversarial loss, use as generator loss""" | |
# Define non-adversarial loss - for example L1 | |
non_adversarial_loss = tf.losses.absolute_difference( | |
gan_model.real_data, gan_model.generated_data) | |
# Define generator loss | |
generator_loss = tf.contrib.gan.losses.least_squares_generator_loss( | |
gan_model, | |
**kwargs) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
import tensorflow as tf | |
class ImportGraph(): | |
""" Importing and running isolated TF graph """ | |
def __init__(self, loc): | |
# Create local graph and use it in the session | |
self.graph = tf.Graph() | |
self.sess = tf.Session(graph=self.graph) | |
with self.graph.as_default(): | |
# Import saved model from location 'loc' into local graph |
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
import tensorflow as tf | |
class Graph(): | |
""" Importing and running isolated TF graph """ | |
def __init__(self, loc): | |
# Create local graph and use it in the session | |
self.graph = tf.Graph() | |
self.sess = tf.Session(graph=self.graph) | |
with self.graph.as_default(): | |
# Import saved model from location 'loc' into local graph |
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
sess = tf.Session() | |
# Import graph from the path and recover session | |
saver = tf.train.import_meta_graph('models/model_name.meta', clear_devices=True) | |
saver.restore(sess, 'models/model_name') | |
# There are TWO options how to access the operation (choose one) | |
# FROM SAVED COLLECTION: | |
activation = tf.get_collection('activation')[0] | |
# BY NAME: |
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
import tensorflow as tf | |
### Linear Regression ### | |
# Input placeholders | |
x = tf.placeholder(tf.float32, name='x') | |
y = tf.placeholder(tf.float32, name='y') | |
# Model parameters | |
W1 = tf.Variable([0.1], tf.float32) | |
W2 = tf.Variable([0.1], tf.float32) | |
W3 = tf.Variable([0.1], tf.float32) | |
b = tf.Variable([0.1], tf.float32) |
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
#!/bin/bash | |
# Update | |
apt-get update && apt-get upgrade -y | |
# Install python+packages and curl | |
apt-get install -y python3 python3-pip python3-numpy python3-scipy python3-matplotlib ipython3 ipython3-notebook python3-pandas python3-nose curl wget | |
# Update pip | |
python3 -m easy_install -U pip | |
# Correctinng python file | |
# which causes stuck during package installation |