- Source your python environment. For me, it is anaconda with the name of virtual environment
base.
source activate base
- Change your directory to where you installed MATLAB
| def learn2(optimizee, unroll_train_steps, retain_graph_flag = False, reset_theta = False): | |
| """retain_graph_flag=False | |
| By default, the dynamic graph is released after each loss_backward | |
| # reset_theta = False | |
| By default, parameters are not initialized randomly before each learning. | |
| """ | |
| if reset_theta == True: | |
| theta_new = torch.empty(dim) | |
| torch.nn.init.uniform_(theta_new, a = -1 , b = 1.0) | |
| theta_init_new = torch.tensor(theta, dtype=torch.float32, requires_grad=True) |
| ## TensorFlow | |
| from tensorflow.python.ops import control_flow_ops | |
| from tensorflow.python.ops import math_ops | |
| from tensorflow.python.ops import state_ops | |
| from tensorflow.python.framework import ops | |
| from tensorflow.contrib import rnn | |
| import tensorflow as tf | |
| class NLayerPerceptron: |
| from NeuralNetwork import NLayerPerceptron | |
| import sys | |
| import warnings | |
| import tensorflow as tf | |
| #It will download and read in the data automatically | |
| from tensorflow.examples.tutorials.mnist import input_data | |
| mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) |
| #!/usr/bin/env python | |
| import rospy | |
| import subprocess | |
| import os | |
| import signal | |
| class RosbagRecord: | |
| def __init__(self): |
| material road | |
| { | |
| technique | |
| { | |
| pass | |
| { | |
| ambient 0.1 0.1 0.1 1.0 | |
| diffuse 0.8 0.8 0.8 1.0 | |
| specular 0.01 0.01 0.01 1.0 2.0 |
| @tf.function | |
| def tfgamma(z): | |
| g = tf.exp(tf.math.lgamma(z)) | |
| return g | |
| @tf.function | |
| def NB(x, mu, phi): | |
| numerator = tfgamma(x + phi)*tf.math.pow(mu,x)*tf.math.pow(phi, phi) | |
| denominator = tfgamma(phi)*tfgamma(x+1) *tf.math.pow((mu + phi),(x+phi)) | |
| return (numerator/denominator) |
| import scanpy | |
| ad = sc.read(filename="Zeisel.h5") | |
| X = ad.X # X is the count matrix |
| # How to install bagpy: | |
| # pip install bagpy | |
| # documentation: https://jmscslgroup.github.io/bagpy/ | |
| # Repo: https://github.com/jmscslgroup/bagpy | |
| import bagpy | |
| from bagpy import bagreader | |
| b = bagreader('/home/ivory/Downloads/2020-06-18-17-30-23.bag') | |
| print(b.topic_table) |