As answers to this Stack Overflow question
reveal, using <!---
and --->
works (view source by clicking "Raw"):
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
# Written by Doug Dahms | |
# | |
# Prints the tree structure for the path specified on the command line | |
from os import listdir, sep | |
from os.path import abspath, basename, isdir | |
from sys import argv | |
def tree(dir, padding, print_files=False): | |
print (padding[:-1] + '+-' + basename(abspath(dir)) + '/') |
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
#include <iostream> | |
#include <map> | |
#include <utility> | |
using namespace std; | |
/* | |
Internally map and set are almost always stored as red-black trees. We do not need to worry about the internal structure, | |
the thing to remember is that the elements of map and set are always sorted in ascending order | |
while traversing these containers. And that’s why it’s strongly not recommended to change the key value while traversing map or set: If you make the modification that breaks the order, it will lead to improper functionality of container’s algorithms, at least. | |
*/ |
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
val a = 4 | |
var b = 3 | |
// if-else | |
val greater_4: Boolean = a>b | |
if(!greater_4) | |
val asquared = a*a | |
asquared*2 | |
else | |
val bsquared = b*b |
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
#include <iostream> | |
using namespace std; | |
struct node{ | |
int val; | |
struct node *right, *left; | |
}; | |
struct node *createNode(int item){ | |
struct node *temp = (struct node *)malloc(sizeof(struct node)); |
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
// #include <iostream> | |
#include <bits/stdc++.h> | |
using namespace std; | |
bool cmp(pair<int,int> a, pair<int,int> b){ | |
return a.second> b.second; | |
} | |
void find_w(map<int,int> m){ | |
vector<pair<int,int>> arr; |
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
# Written by thepurpleowl | |
# | |
# Filter out files while retaining the directory structure | |
import os | |
import json | |
from shutil import copyfile | |
import pathlib | |
# dev__manifest contains path information of unfiltered files |
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 | |
from tensorflow.python.tools.inspect_checkpoint import print_tensors_in_checkpoint_file | |
import re | |
latest_ckp = tf.train.latest_checkpoint('./training_checkpoints') | |
print_tensors_in_checkpoint_file(latest_ckp, all_tensors=True, tensor_name='') | |
# to check specific variable in checkpoint | |
# [print(var.variables) for var in tf.train.list_variables(latest_ckp) if re.match(r'.*decoder/embedding/embeddings/.ATTRIBUTES/.*',var[0])] |
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 numpy as np | |
import tensorboard as tb | |
from torch.utils.tensorboard import SummaryWriter | |
import tensorflow as tf | |
tf.io.gfile = tb.compat.tensorflow_stub.io.gfile | |
writer = SummaryWriter() | |
writer.add_embedding(<embeddings>, <labels>) # (doc_vector, Y_true[:TRAIN_SIZE_EVALS[-3]]) | |
writer.close() | |
%load_ext tensorboard |