;; SICP p.46 Exercise 1.16
#lang racket
;; The recursive procedure of power. Both the
;; space and computation cost are O(n).
(define (power-rec b n)
(if (= n 0)
1
-- The ASM compiler identification is Clang with GNU-like command-line | |
-- Found assembler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc | |
-- The C compiler identification is AppleClang 14.0.0.14000029 | |
-- The CXX compiler identification is AppleClang 14.0.0.14000029 | |
-- Detecting C compiler ABI info | |
-- Detecting C compiler ABI info - done | |
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped | |
-- Detecting C compile features | |
-- Detecting C compile features - done | |
-- Detecting CXX compiler ABI info |
import torch | |
import pandas | |
class TT(torch.nn.Module): | |
def __init__(self, n_user, n_item): | |
super(TT, self).__init__() | |
# The dimensionality of embedding vectors 32 is from | |
#https://towardsdatascience.com/movielens-1m-deep-dive-part-ii-tensorflow-recommenders-4ca358cc886e | |
emb_dim = 128 | |
self.u = torch.nn.Embedding(n_user, emb_dim) |
import pandas | |
import seaborn as sns | |
import matplotlib.pyplot as plt | |
from typing import Dict, List, Tuple | |
def freq(df: pandas.DataFrame, column_name: str) -> Dict[int, int]: | |
"""Count the word frequency of a pandas data frame column.""" | |
ret = {} | |
for i in range(len(df[column_name])): | |
k = df[column_name][i] |
(base) wkyi@u22vm:~$ gdb python | |
GNU gdb (Ubuntu 12.0.90-0ubuntu1) 12.0.90 | |
For help, type "help". | |
Type "apropos word" to search for commands related to "word"... | |
Reading symbols from python... | |
(gdb) b at::Tensor::mm | |
Function "at::Tensor::mm" not defined. | |
Make breakpoint pending on future shared library load? (y or [n]) y | |
Breakpoint 1 (at::Tensor::mm) pending. |
# To run this program, type the following commands in a terminal. | |
# | |
# MASTER_ADDR=localhost MASTER_PORT=12306 RANK=0 WORLD_SIZE=2 python3 s.py & | |
# MASTER_ADDR=localhost MASTER_PORT=12306 RANK=1 WORLD_SIZE=2 python3 s.py & | |
import os | |
import sys | |
import time | |
import logging |
import torch | |
class AssocEmb(torch.nn.Module): | |
def __init__(self, dim: list[int]): | |
super(AssocEmb, self).__init__() | |
self.dim = dim | |
self.tbl = torch.nn.ParameterDict() | |
def forward(self, idx: str) -> torch.Tensor: |
;; Move emacs window to the right half screen. -50 is a hack for macOS. | |
(let ((frame (selected-frame)) | |
(one-half-display-pixel-width (/ (display-pixel-width) 2))) | |
(set-frame-width frame one-half-display-pixel-width nil 'pixelwise) | |
(set-frame-height frame (- (display-pixel-height) 50) nil 'pixelwise) | |
(set-frame-position frame one-half-display-pixel-width 0)) |
import asyncio | |
from aiostream import stream # You need to pip install aiostream | |
from datetime import datetime | |
async def agint(n:int, v:int): | |
for _ in range(n): | |
await asyncio.sleep(0.1) | |
yield v |
Thank you for your interest in contributing documentation and related software code to a project hosted or managed by Ant Financial Services Group, or any of its affiliates. In order to clarify the intellectual property license granted with Contributions from any person or entity, Ant Financial must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This version of the Contributor License Agreement allows an individual to submit Contributions to the applicable project. If you are making a submission on behalf of a legal entity, then you should sign the separation Corporate Contributor License Agreement.
You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Ant Financial. Except for the license granted herein to Ant Financial and recipients of documentation and software distributed by Ant Financial, Yo