This file contains hidden or 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 torch | |
import numpy as np | |
import pickle | |
f = open('/home/eriba/software/pytorch/examples-edgarriba/triplet/nan_test.pkl', 'rb') | |
data = pickle.load(f) | |
a = torch.from_numpy(data['a']).cuda() |
This file contains hidden or 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
""" | |
Play with saving . | |
Closest: | |
https://github.com/tensorflow/tensorflow/issues/616#issuecomment-205620223 | |
""" | |
import numpy as np | |
import tensorflow as tf | |
from tensorflow.python.platform import gfile |
This file contains hidden or 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
from graphviz import Digraph | |
import torch | |
from torch.autograd import Variable, Function | |
def iter_graph(root, callback): | |
queue = [root] | |
seen = set() | |
while queue: | |
fn = queue.pop() | |
if fn in seen: |
This file contains hidden or 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
// | |
// Thanks Kevin! | |
// https://gist.github.com/SheffieldKevin/566dc048dd6f36716bcd | |
// | |
import CoreGraphics | |
import CoreImage | |
extension CGImage { | |
This file contains hidden or 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 Foundation | |
import CoreImage | |
/** | |
Based on: https://gist.github.com/SheffieldKevin/566dc048dd6f36716bcd | |
Updated for Swift 5.5 (Xcode 13) | |
*/ | |
class ImageDiff { | |
func compare(leftImage: CGImage, rightImage: CGImage) throws -> Int { |
This file contains hidden or 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
/** | |
* Cloudflare Worker for Server-Sent Events (SSE) | |
* | |
* This worker demonstrates how to set up an SSE endpoint | |
* that sends an initial message and then periodic updates. | |
*/ | |
// Listen for incoming requests | |
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)); |
OlderNewer