name | type |
---|---|
torch.Tensor | <class 'torch._C._TensorMeta'> |
torch.e | <class 'float'> |
torch.t | <class 'builtin_function_or_method'> |
torch.torch | <class 'module'> |
torch.eig | <class 'function'> |
torch.ne | <class 'builtin_function_or_method'> |
torch.nn |
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
#include <hip/hip_runtime.h> | |
#include <iostream> | |
#define BLOCK_SIZE 256 | |
__global__ void vecAdd(const float* __restrict__ A, | |
const float* __restrict__ B, | |
float* __restrict__ C, | |
int n) | |
{ |
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
# Make sure you have these installed: | |
# pip install torch pandas faiss-gpu (or faiss-cpu if no GPU) | |
import pandas as pd | |
import torch | |
import torch.nn as nn | |
import torch.optim as optim | |
from torch.utils.data import Dataset, DataLoader | |
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 next_row(a): | |
return [0] + [a + b for a, b in zip(a, a[1:])] + [0] | |
def g(n): | |
lst = [[0, 1, 0]] | |
for _ in range(n): | |
lst.append(next_row(lst[-1])) | |
return lst |
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 pynput import keyboard | |
import pyperclip | |
import time | |
# Initialize | |
with open("your_file.txt", "r") as f: | |
lines = f.readlines() | |
# Remove newline characters | |
lines = [line.strip() for line in lines] |
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
# Torch objects used in learnpytorch.io website | |
|name|type| | |
|----|----| | |
|torch.Tensor|<class 'torch._C._TensorMeta'>| | |
|torch.e|<class 'float'>| | |
|torch.t|<class 'builtin_function_or_method'>| | |
|torch.torch|<class 'module'>| | |
|torch.eig|<class 'function'>| | |
|torch.ne|<class 'builtin_function_or_method'>| | |
|torch.nn|<class 'module'>| |
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
#include <algorithm> | |
#include <concepts> | |
#include <functional> | |
#include <iostream> | |
#include <memory> | |
#include <vector> | |
template <typename T> | |
concept Drawable = requires(T t) { | |
{ t.draw() } -> std::same_as<void>; |
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
import pandas as pd | |
import matplotlib.pyplot as plt | |
import matplotlib.animation as animation | |
from matplotlib import style | |
fig = plt.figure() | |
ax1 = fig.add_subplot(1,1,1) | |
xs = [] | |
ys = [] |
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
import operator | |
from itertools import cycle | |
from numbers import Number | |
import numpy as np | |
def broadcast(a, b, op): | |
if isinstance(a, Number) and isinstance(b, Number): |
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
#include <Eigen/Dense> | |
#include <Eigen/IterativeLinearSolvers> | |
#include <algorithm> | |
#include <iostream> | |
#include <random> | |
#include <vector> | |
std::pair<Eigen::MatrixXf, Eigen::MatrixXf> GenerateData(size_t n) { | |
std::vector<float> x_data(n); |
NewerOlder