Skip to content

Instantly share code, notes, and snippets.

View HSILA's full-sized avatar

HSILA HSILA

  • McMaster University
  • Canada
  • 20:37 (UTC -04:00)
View GitHub Profile
@HSILA
HSILA / onnx_cumsum.py
Last active July 2, 2022 06:15
ONNX CumSum operator shouldn't get boolean but model checker won't check it
import torch
from torch import nn
import onnx
import onnxruntime
a = torch.tensor([12, 0, 5, 154], dtype=torch.float32)
# a.to(torch.bool) = tensor([True, False, True, True])
# ~a.to(torch.bool) = tensor([False, True, False, False])
@HSILA
HSILA / BiEncoderWrapper.py
Created April 23, 2025 05:01
contrastors BiEncoderWrapper
import os
import numpy as np
from typing import Any
import torch
import mteb
from transformers import AutoTokenizer
\documentclass[tikz,border=2pt]{standalone}
\usepackage{amsmath,bm}
\usepackage{tikz}
% \usetikzlibrary{arrows.meta} % if you need extra arrowheads
\begin{document}
\begin{tikzpicture}
\node at (0,1.8) (h) {$\longleftarrow\,$Representation$\,\longrightarrow$};
\node[draw, circle] at (0,-1) (x) {$\bm{x}$};
\node[draw, circle] at (-2.5,0) (x1) {$\tilde{\bm{x}}_i$};
\node[draw, circle] at (2.5,0) (x2) {$\tilde{\bm{x}}_j$};