Skip to content

Instantly share code, notes, and snippets.

@asmeurer
asmeurer / grammar-checker-gpt-prompt.txt
Last active April 26, 2024 06:25
Grammar Checker GPT Prompt
https://chat.openai.com/g/g-E9aHgMUwv-grammar-checker-gpt
=========================================================================== test session starts ===========================================================================
platform darwin -- Python 3.11.7, pytest-8.0.0, pluggy-1.4.0
rootdir: /Users/aaronmeurer/Documents/array-api-tests
configfile: pytest.ini
plugins: pudb-0.7.0, hypothesis-6.99.2, json-report-1.5.0, cov-4.1.0, doctestplus-1.1.0, typeguard-4.1.5, flakes-4.0.5
collected 27 items / 26 deselected / 1 selected
array_api_tests/test_linalg.py F [100%]
================================================================================ FAILURES =================================================================================
import torch
from torch.testing import make_tensor
from torch.fx.experimental.proxy_tensor import make_fx
from torch.utils.benchmark import Timer, Compare
from torch._inductor.compile_fx import compile_fx_inner, cudagraphify_impl
from torch._inductor.decomposition import decompositions
from itertools import product
import numpy as np
@asmeurer
asmeurer / duplicate negative index handling
Last active November 30, 2023 23:01
take decomposition benchmark
(262144,)
[2023-11-30 15:32:07,909] torch._inductor.graph.__output_code: [DEBUG] Output code:
[2023-11-30 15:32:07,909] torch._inductor.graph.__output_code: [DEBUG]
[2023-11-30 15:32:07,909] torch._inductor.graph.__output_code: [DEBUG] from ctypes import c_void_p, c_long
[2023-11-30 15:32:07,909] torch._inductor.graph.__output_code: [DEBUG] import torch
[2023-11-30 15:32:07,909] torch._inductor.graph.__output_code: [DEBUG] import math
[2023-11-30 15:32:07,909] torch._inductor.graph.__output_code: [DEBUG] import random
[2023-11-30 15:32:07,909] torch._inductor.graph.__output_code: [DEBUG] import os
[2023-11-30 15:32:07,909] torch._inductor.graph.__output_code: [DEBUG] import tempfile
[2023-11-30 15:32:07,909] torch._inductor.graph.__output_code: [DEBUG] from math import inf, nan
@asmeurer
asmeurer / sympy-gpt-prompt
Last active January 11, 2024 01:56
SymPy GPT prompt
You are a specialized GPT designed to assist users with the SymPy Python library. Your primary function is to help users understand and utilize SymPy for their mathematical and symbolic computation needs. You are equipped with the ability to execute Python code, particularly focusing on SymPy. Before executing any code, you will always install the latest version of SymPy provided by the user as a wheel file. Additionally, you have access to a PDF of SymPy's documentation, which you can reference to provide accurate and detailed explanations. You are knowledgeable in Python and SymPy, capable of solving a wide range of mathematical problems and offering code examples and explanations. If you are presented with a mathematical question, you should write code using SymPy to solve the problem. If you find that a problem cannot be solved by SymPy, you may suggest alternative Python libraries to solve the problem. Remember that the point is not just to solve people's problems for them, but to teach them how to use
@asmeurer
asmeurer / fn4.py
Created October 23, 2023 21:45
fn4
def inner_fn(index):
i0, i1 = index
tmp0 = ops.index_expr(i1, dtype=torch.int64)
tmp1 = ops.to_dtype(tmp0, torch.float32, src_dtype=torch.int64)
tmp2 = ops.constant(225.0, torch.float32)
tmp3 = tmp1 < tmp2
tmp4 = ops.index_expr(i1, dtype=torch.int64)
tmp5 = ops.to_dtype(tmp4, torch.float32, src_dtype=torch.int64)
tmp6 = ops.constant(0.0066815144766146995, torch.float32)
tmp7 = tmp5 * tmp6
^CYou can add @seed(209619979639939998162824709723232908623) to this test or run pytest with --hypothesis-seed=209619979639939998162824709723232908623 to reproduce this failure.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
config = <_pytest.config.Config object at 0x7ff694b54a90>, doit = <function _main at 0x7ff692e01c10>
def wrap_session(
config: Config, doit: Callable[[Config, "Session"], Optional[Union[int, ExitCode]]]
) -> Union[int, ExitCode]:
"""Skeleton command line program."""
>>> import scipy.signal
>>> import cupy
>>> x = cupy.zeros((50_000_000,))
>>> x[10] = 1.
>>> scipy.signal.welch(x)
Traceback (most recent call last):
2023-02-21T22:44:21.0827343Z Draw 1 (x): tensor(184550662, dtype=torch.int32)
2023-02-21T22:44:21.0827853Z Draw 2 (s): 0
2023-02-21T22:44:21.0828094Z Trying example: test_remainder(
2023-02-21T22:44:21.0828325Z data=data(...),
2023-02-21T22:44:21.0828668Z ctx=BinaryParamContext(<__mod__(x, s)>),
2023-02-21T22:44:21.0828929Z )
2023-02-21T22:44:21.0829235Z Draw 1 (x): tensor(-16, dtype=torch.int32)
2023-02-21T22:44:21.0829490Z Draw 2 (s): 74
2023-02-21T22:44:21.3006068Z Fatal Python error: Floating point exception
2023-02-21T22:44:21.3006317Z
>>> from sympy.functions.elementary.trigonometric import _cospi257
>>> expr = _cospi257()
>>> expr
sqrt(sqrt(2)*sqrt(-sqrt(-2*sqrt((-sqrt(257)/8 - sqrt(-4*sqrt(257) + (-sqrt(257)/4 - 1/4 + sqrt(64 + (-sqrt(257)/2 - 1/2)**2)/2)**2 + 16 + 4*sqrt(64 + (-sqrt(257)/2 - 1/2)**2))/2 - 1/8 + sqrt(64 + (-sqrt(257)/2 - 1/2)**2)/4)**2 + 2*sqrt(-4*sqrt(257) + (-sqrt(257)/4 - 1/4 + sqrt(64 + (-sqrt(257)/2 - 1/2)**2)/2)**2 + 16 + 4*sqrt(64 + (-sqrt(257)/2 - 1/2)**2)) + 4 + 2*sqrt(-4*sqrt(257) - 4*sqrt(64 + (-sqrt(257)/2 - 1/2)**2) + 16 + (-sqrt(64 + (-sqrt(257)/2 - 1/2)**2)/2 - sqrt(257)/4 - 1/4)**2) + 2*sqrt((-1/2 + sqrt(257)/2)**2 + 64) + 4*sqrt(-4*sqrt((-1/2 + sqrt(257)/2)**2 + 64) + (-sqrt((-1/2 + sqrt(257)/2)**2 + 64)/2 - 1/4 + sqrt(257)/4)**2 + 16 + 4*sqrt(257)) + 2*sqrt(257)) - sqrt(16 + 4*sqrt((-1/2 + sqrt(257)/2)**2 + 64) + 4*sqrt(257) + (-1/4 + sqrt(257)/4 + sqrt((-1/2 + sqrt(257)/2)**2 + 64)/2)**2) - 2*sqrt(-2*sqrt(257) - 2*sqrt(16 + 4*sqrt((-1/2 + sqrt(257)/2)**2 + 64) + 4*sqrt(257) + (-1/4 + sqrt(257)/4 + sqrt