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
def _diff_x(src: Tensor, w: int) -> Tensor: | |
cum_src = src.cumsum(-2) | |
left = cum_src[..., w : 2 * w + 1, :] | |
middle = cum_src[..., 2 * w + 1 :, :] - cum_src[..., : -2 * w - 1, :] | |
right = cum_src[..., -1:, :] - cum_src[..., -2 * w - 1 : -w - 1, :] | |
return torch.vstack((left, middle, right)) | |
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
""" | |
MIT License | |
Copyright (c) 2024 Arseniy Terekhin | |
Copyright (c) 2024 Dmitry Sidorchuk | |
""" | |
from __future__ import annotations | |
from typing import Literal | |
import torch |
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
// based on https://stackoverflow.com/questions/1997661/unique-object-identifier-in-javascript | |
const getID = (function() { // FOR DEBUG ONLY. DO NOT COMMIT! | |
var id = 0; | |
return function(o: any): number { | |
if ( typeof o.__uniqueid != "undefined" ) { | |
return o.__uniqueid; | |
} | |
Object.defineProperty(o, "__uniqueid", { |
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 PIL import Image | |
import numpy as np | |
def main(): | |
arr = np.asarray([[0,0,0],[0,255,0],[0,0,0]], dtype=np.uint8) | |
img = Image.fromarray(arr) | |
with open('ITU-R_BT2020(beta).icc', 'rb') as f: | |
img.info['icc_profile'] = 'f.read()' | |
img.save('path.png') |
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
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.00.24215.1 | |
TITLE c:\users\senyai\documents\visual studio 2015\projects\cpp_test_2016\cpp_test_2016\cpp_test_2016.cpp | |
.686P | |
.XMM | |
include listing.inc | |
.model flat | |
INCLUDELIB OLDNAMES |