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/sh | |
# cpbar: cp with a progress bar | |
MAXCOLS=80 | |
SLEEP=.5 | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: $(basename $0) <SOURCE> <DEST>" >&2 | |
exit 1 |
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
\documentclass{article} | |
\usepackage{tikz} | |
\begin{document} | |
\centering | |
\begin{tikzpicture} | |
\definecolor{gtRed}{RGB}{85,0,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
#include <Eigen/Dense> | |
template <class MatT> | |
Eigen::Matrix<typename MatT::Scalar, MatT::ColsAtCompileTime, MatT::RowsAtCompileTime> | |
pseudoinverse(const MatT &mat, typename MatT::Scalar tolerance = typename MatT::Scalar{1e-4}) // choose appropriately | |
{ | |
typedef typename MatT::Scalar Scalar; | |
auto svd = mat.jacobiSvd(Eigen::ComputeFullU | Eigen::ComputeFullV); | |
const auto &singularValues = svd.singularValues(); | |
Eigen::Matrix<Scalar, MatT::ColsAtCompileTime, MatT::RowsAtCompileTime> singularValuesInv(mat.cols(), mat.rows()); |
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
def freeze_session(session, keep_var_names=None, output_names=None, clear_devices=True): | |
""" | |
Freezes the state of a session into a prunned computation graph. | |
Creates a new computation graph where variable nodes are replaced by | |
constants taking their current value in the session. The new graph will be | |
prunned so subgraphs that are not neccesary to compute the requested | |
outputs are removed. | |
@param session The TensorFlow session to be frozen. |
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 unreal_engine as ue | |
import asyncio | |
import threading | |
import queue | |
import msgpack | |
try: | |
import msgpack_numpy as mnp | |
mnp.patch() |
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
# Split a number into parts with a fixed size unit size | |
def split_number(number, parts, unit, min_units=0): | |
current = [] | |
num_units = round(number / unit) | |
for c in _divide_number_rec(num_units, parts, min_units, current): | |
yield tuple(u * unit for u in c) | |
def _split_number_rec(num_units, parts, last_units, current): | |
if parts <= 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
We do not (and cannot) store any personal information, nor use any third-party app or service that does so. |
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 onnx | |
from onnx import helper, TensorProto, save_model | |
from onnx.checker import check_model | |
body = helper.make_graph( | |
name='body', | |
nodes=[ | |
helper.make_node('Add', ['a', 'b_in'], ['my_local']), | |
helper.make_node('Sub', ['a', 'b_in'], ['b_out']), | |
helper.make_node('Greater', ['my_local', 'b_out'], ['keep_going_out']), |
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
// lib/Conversion/TorchOnnxToTorch/DefaultDomainGtoP.cpp | |
// ... | |
void mlir::torch::onnx_c::populateDefaultDomainGtoP( | |
OnnxCustomOpConversionPattern &patterns) { | |
// ... | |
patterns.onOp( | |
"Loop", 13, [](OpBinder binder, ConversionPatternRewriter &rewriter) { | |
// Get all operands (maxTripCount, cond, ....inits....) | |
llvm::SmallVector<Value> operands; |