Skip to content

Instantly share code, notes, and snippets.

from captum.attr import IntegratedGradients
import pickle
import torch
with open("./tst_save.pkl", "rb") as f:
trained_model = pickle.load(f)
trained_model.eval()
X = torch.load("./X_test.pt")
@isears
isears / histogram.py
Created February 8, 2021 21:13
Tensorflow fast XLA histograms
import tensorflow as tf
test_mat = tf.random.uniform(shape=[10, 10, 10, 1], maxval=255, dtype=tf.int32)
hists = tf.math.reduce_sum(
tf.one_hot(test_mat, depth=256, on_value=1, off_value=0, axis=0),
axis=1
)
@isears
isears / register.sh
Created December 21, 2019 20:18
Register patient on staging through proxy
# Get an Identifier
curl "https://openmrs-staging.fortitudotelemed.com/mobile-gateway/fetch" --insecure
# Replace identifier in JSON data with new identifier for new patient registration
curl -X POST "https://openmrs-staging.fortitudotelemed.com/mobile-gateway/register" -H "Content-type: application/json" --insecure -d '{ "identifiers": [{ "identifier":"1000MJ", "identifierType":"05a29f94-c0ed-11e2-94be-8c13b969e334", "location":"aff27d58-a15c-49a6-9beb-d30dcfc0c66e", "preferred": true }], "person": { "gender": "M", "age": 47, "birthdate": "1970-01-01T00:00:00.000+0100","birthdateEstimated": false, "dead": false, "deathDate": null, "causeOfDeath": null, "names": [{"givenName": "Thomas5", "familyName": "Smith"}], "attributes":[{"attributeType":{"uuid":"14d4f066-15f5-102d-96e4-000c29c2a5d7"}, "value":"4444444442"}]}}'
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
<?php
// Only pertinent if cloning another installation database
if ( ! empty($installer->clone_database)) {
echo "Dumping source database...";
flush();
if ( ! $installer->create_dumpfiles() ) {
echo $installer->error_message;
break;
}