QuestionId int64 74.8M 79.8M | UserId int64 56 29.4M | QuestionTitle stringlengths 15 150 | QuestionBody stringlengths 40 40.3k | Tags stringlengths 8 101 | CreationDate stringdate 2022-12-10 09:42:47 2025-11-01 19:08:18 | AnswerCount int64 0 44 | UserExpertiseLevel int64 301 888k | UserDisplayName stringlengths 3 30 β |
|---|---|---|---|---|---|---|---|---|
78,991,776 | 388,951 | How can I reference the type hint for an instance variable on another class? | <p>The OpenAI Python types define a <code>Batch</code> class with a <a href="https://github.com/openai/openai-python/blob/192b8f2b6a49f462e48c1442858931875524ab49/src/openai/types/batch.py#L39-L42" rel="nofollow noreferrer"><code>status</code> field</a>:</p>
<pre class="lang-py prettyprint-override"><code>class Batch(B... | <python><python-typing> | 2024-09-16 20:56:16 | 1 | 17,142 | danvk |
78,991,666 | 825,227 | Looking to create column names from top rows in dataframe | <p>I have a dataframe that looks like this:</p>
<pre><code> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
0 9.0 8.0 7.0 6.0 5.0 4.0 3.0 2.0 1.0 0.0 0.0 1.0 2.... | <python><pandas> | 2024-09-16 20:16:13 | 1 | 1,702 | Chris |
78,991,594 | 6,930,340 | Polars: Advanced cross sectional trading algorithm | <p>I have a polars dataframe containing stock returns as well as cross-sectional ranks in a tidy/long <code>pl.DataFrame</code>.</p>
<pre><code>import polars as pl
prices = pl.DataFrame(
{
"symbol": [
*["symbol1"] * 7,
*["symbol2"] * 6,
*[&q... | <python><python-polars> | 2024-09-16 19:52:28 | 0 | 5,167 | Andi |
78,991,587 | 901,444 | getting last character from a string that may or may not be unicode | <p>I'm parsing a file that contains both alpha strings and unicode/UTF-8 strings containing IPA pronunciations.</p>
<p>I want to be able to obtain the last character of a string, but sometimes those characters occupy two spaces, e.g.</p>
<pre><code>syl = 'tyl' # plain ascii
last_char = syl[-1]
# last char is 'l'
syl ... | <python><string><unicode><utf-8><character> | 2024-09-16 19:51:07 | 4 | 8,708 | slashdottir |
78,991,568 | 615,525 | How to Increase Accuracy of Text Read in Images Using Microsoft Azure Computer Vision AI | <p>I'm new to Microsoft Azure AI Computer Vision. I am using Cognitive Services and the Computer Vision Client in a Python Program to do two things:</p>
<ol>
<li>Extract text from a JPG Image using Optical Character Recognition (OCR)</li>
<li>Use Cognitive Services to provide a Description of the Image</li>
</ol>
<p>Af... | <python><azure><ocr><azure-cognitive-services> | 2024-09-16 19:43:15 | 1 | 353 | user615525 |
78,991,562 | 210,867 | How to process tasks as they complete when using TaskGroup? | <p>I understand the <a href="https://textual.textualize.io/blog/2023/02/11/the-heisenbug-lurking-in-your-async-code/" rel="nofollow noreferrer">arguments</a> for using the newer <code>TaskGroup</code> in place of older mechanisms based on <code>create_task()</code>.</p>
<p>However, <code>TaskGroup</code> exits after <e... | <python><parallel-processing><python-asyncio> | 2024-09-16 19:39:05 | 2 | 8,548 | odigity |
78,991,298 | 4,577,467 | Can a Python class derive from a SWIG-wrapped C++ class? | <p>I am using SWIG version 4.0.2 in a Windows Subsystem for Linux (WSL) Ubuntu distribution. I can wrap a C++ class (<code>EventProcessor</code>), create an instance of that class in Python, and provide that instance to a wrapped global C++ function (<code>registerEventProcessor()</code>). But, can I define a class i... | <python><c++><swig> | 2024-09-16 18:07:51 | 1 | 927 | Mike Finch |
78,991,208 | 6,770,842 | How to generate minimal epub file using ebooklib | <p>I would like to use python and ebooklib to generate a "minimal" epub from an existing one. In other words, I want to keep only the required subset of metadata (title, creator, date, publisher), cover image, toc, spine, and (obviously) the whole text, and remove all extra-stuff (extra metadata, extra images... | <python><epub><ebooklib> | 2024-09-16 17:38:10 | 0 | 2,427 | sciroccorics |
78,991,192 | 8,810,517 | Race Condition in Confluent Kafka Consumer with Asyncio and ThreadPoolExecutor in Python | <p>I'm working on a Python application where I need to consume messages from a Kafka topic, process them by making an async API request, and produce a response to an outbound Kafka topic. Since the Kafka client I'm using is synchronous (confluent-kafka), I decided to use ThreadPoolExecutor to run the consumer in a sepa... | <python><multithreading><apache-kafka><async-await><python-asyncio> | 2024-09-16 17:33:58 | 1 | 526 | Abhay |
78,991,070 | 6,618,225 | Column manipulation based on headline values within rows | <p>I have a Pandas dataframe with a column that contains different types of values and I want to create a new column out of it based on the information inside that column. Every few rows there is a kind of "headline" row that should define that values for the following rows until the next headline row that th... | <python><pandas> | 2024-09-16 16:50:30 | 3 | 357 | Kai |
78,991,020 | 179,014 | Why are type annotations needed in Python dataclasses? | <p>In opposition to standard classes in Python dataclasses fields must have a type annotation. But I don't understand what the purpose of these type annotations really is. One can create a dataclass like this</p>
<pre><code>from dataclasses import dataclass, fields
@dataclass
class Broken:
field1: str = "defa... | <python><syntax><python-typing><python-dataclasses> | 2024-09-16 16:33:32 | 2 | 11,858 | asmaier |
78,990,992 | 16,912,844 | Circular Import During `dictConfig` in Python Logging | <p>I have a custom logger with the below structure, it uses <code>dictConfig</code> to read the <code>default.json</code> file for the logger. It works fine, but when I wanted to nest under a project root, I got an error while importing it. Any reason why that might happen? I double checked the path and it see to be co... | <python><logging> | 2024-09-16 16:20:33 | 0 | 317 | YTKme |
78,990,976 | 18,476,381 | sqlalchemy contains_eager not loading nested relationships | <p>I have tables of motor and motor_cycle, which is a one to many relationship. I would like to join these tables and show all the motor_cycles for a motor with an <strong>OPTIONAL</strong> condition on the motor_cycle table. Originally I was using <strong>joinedload</strong> but found after applying the where conditio... | <python><sql><sqlalchemy> | 2024-09-16 16:15:16 | 1 | 609 | Masterstack8080 |
78,990,912 | 5,838,180 | Scatter plot on a region of the sky with a circle | <p>I am trying to do a scatter plot of a few data points on a region of the sky and then add a circle to the plot. Note, that I don't want a plot of the full sky, just of the region around the data points. The coordinates of the data points in degrees are:</p>
<pre><code>ra = np.array([248.3, 249.8, 250.2, 250.5, 250.5... | <python><matplotlib><coordinates><region><astropy> | 2024-09-16 15:53:13 | 1 | 2,072 | NeStack |
78,990,852 | 7,200,174 | Improve Pandas and Vectorization Performance on large dataset | <p><strong>CONTEXT</strong></p>
<p>I have a large dataset (100-250mb) in a CSV file and need to assign groupings to the population of people. The groupings are based on a dynamic ruleset defined in another CSV file. For ease of reproduction, I've added sample data and sample 'rulesets' / query strings</p>
<p><strong>... | <python><pandas><dataframe><performance><vectorization> | 2024-09-16 15:36:56 | 2 | 331 | KL_ |
78,990,761 | 12,352,239 | Where are pip dependencies installed in a docker image? | <p>I have a docker file that is using poetry to install dependencies e.g.</p>
<pre><code>FROM public.ecr.aws/lambda/python:3.12
# Install poetry
RUN pip install "poetry"
WORKDIR ${LAMBDA_TASK_ROOT}
COPY poetry.lock pyproject.toml ${LAMBDA_TASK_ROOT}/
# Project initialization:
RUN poetry config virtualenvs.... | <python><docker> | 2024-09-16 15:07:12 | 1 | 480 | 219CID |
78,990,748 | 16,226,816 | Torch backward PowBackward0 causes nan gradient where it shouldn't | <p>I have a pytorch tensor with NaN inside, when I calculate the loss function using a simple MSE Loss the gradient becomes NaN even if I mask out the NaN values.</p>
<p>Weirdly this happens only when the mask is applyied after calculating the loss and only when the loss has a pow operation inside. The various cases fo... | <python><pytorch> | 2024-09-16 15:04:08 | 1 | 378 | Paul_0 |
78,990,683 | 2,311,719 | How can run vLLM model on a multi GPU server | <p>I want to run an LLM model on a multi-gpu server (4 GPU) using vLLM.</p>
<p>Here is the command line I run:</p>
<pre><code>python3 -m vllm.entrypoints.api_server --model bjaidi/Phi-3-medium-128k-instruct-awq --quantization awq --dtype auto --gpu-memory-utilization 0.8
</code></pre>
<p>I got this error:</p>
<pre><cod... | <python><gpu><large-language-model><vllm> | 2024-09-16 14:46:27 | 1 | 860 | Ali Ait-Bachir |
78,990,589 | 1,756,833 | How to merge and match different length dataframes (lists) in Python/Pandas | <p>I have over 12 dataframes that I want to merge into a single dataframe, where row values match for each column (or null if they don't exist). Each dataframe has a different number of rows, but will never repeat values. The goal is to both identify common values and missing values.</p>
<p>Eg.df1</p>
<pre><code>id la... | <python><pandas><dataframe> | 2024-09-16 14:23:05 | 2 | 3,139 | KHibma |
78,990,487 | 3,801,449 | ReadTheDocs Sphinx: WARNING: Field list ends without a blank line; unexpected unindent | <p>I'm documenting my Python package using Sphinx. But I've come across several warnings I have no idea, what to do about. All of them are occurring in my module-level docstrings, not inside of classes or methods.</p>
<p>When trying to build my documentation on ReadTheDocs I'm getting the following error:</p>
<pre><cod... | <python><python-sphinx><read-the-docs><autodoc><sphinx-napoleon> | 2024-09-16 13:54:09 | 1 | 3,007 | Eenoku |
78,990,400 | 12,719,086 | How can I keep Dask workers busy when processing large datasets to prevent them from running out of tasks? | <p>I'm trying to process a large dataset (around 1 million tasks) using Dask distributed computing in Python. (I am getting data from a database to process it, and I am retriving around 1M rows). Here I have just made a simpler version of my code:</p>
<p>Each task simulates some computation, and I want to efficiently d... | <python><dask><dask-distributed><dask-delayed> | 2024-09-16 13:33:10 | 1 | 471 | Polymood |
78,990,308 | 1,103,595 | How do I download wheels for the allosaurus python module? | <p>I'm having trouble understanding how to download wheels for a Python project. I need to build a set of wheels for a Blender addon - Blender has recently changed it's addon requirements, so I need to build wheels for it now.</p>
<p>Anyhow, I want to use the allosaurus package. It has dependencies on a lot of other ... | <python><windows><macos><pip> | 2024-09-16 13:02:40 | 1 | 5,630 | kitfox |
78,990,178 | 17,082,611 | Unable to import module 'src.main': No module named 'dependencies' when uploading FastAPI zipped project to AWS Lambda | <p>I am developing a simple FastAPI app and I want to deploy it on AWS Lambda.</p>
<p>This is the structure of the project:</p>
<p><a href="https://i.sstatic.net/XWxCJ1ec.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XWxCJ1ec.png" alt="structure" /></a></p>
<p>And I ran this command for creating the <c... | <python><amazon-web-services><aws-lambda><fastapi> | 2024-09-16 12:27:30 | 1 | 481 | tail |
78,989,984 | 8,208,804 | Optimize tree-traversal over table of data | <p>I have a tree which contains links between multiple nodes. I also have a dataframe with 1 million rows. There is a mapping between tree nodes and dataframe columns as follows:</p>
<pre class="lang-py prettyprint-override"><code>import networkx as nx
import pandas as pd
import numpy as np
g = nx.DiGraph()
g.add_edg... | <python><pandas><dataframe><tree><tree-traversal> | 2024-09-16 11:37:18 | 1 | 1,462 | Sreekar Mouli |
78,989,835 | 11,720,066 | AWS Athena with python - is it possible to mock with moto while still testing the sql? | <p>My code performs sql queries on Athena using <code>boto3</code>.</p>
<p>I want to be able to test the entire functionality, but avoiding the actual access to athena. I need the data to be fetched based on the query string my code sends and the actual data I put in mocked <code>s3</code> as part of the tests setup.</... | <python><boto3><amazon-athena><moto> | 2024-09-16 10:53:15 | 1 | 613 | localhost |
78,989,606 | 2,491,541 | Set Python Environment and Execute Python Code in PHP Script | <p>I am trying to convert the vcd file to wavedrom json file using the python library</p>
<p><a href="https://github.com/Toroid-io/vcd2wavedrom" rel="nofollow noreferrer">https://github.com/Toroid-io/vcd2wavedrom</a></p>
<p>when I run on my terminal the below code works fine</p>
<pre><code> source /var/www/xxx/vcd2wave... | <python><php> | 2024-09-16 09:41:08 | 0 | 6,891 | Alaksandar Jesus Gene |
78,989,501 | 4,105,307 | Is there a simple way to hide database credentials in psycopg2 error messages | <p>I have recently realised that some error messages, in psycopg2, display the full database uri. This dbi's credentials are obviously secret, and access to them is far more secure than the access to the logs.</p>
<pre><code>psycopg2.OperationalError: connection to server at "my_database_uri.including_password.in_... | <python><psycopg2> | 2024-09-16 09:11:32 | 1 | 454 | DarksteelPenguin |
78,989,466 | 13,849,446 | Can not Install Ryu: AttributeError: module 'setuptools.command.easy_install' has no attribute 'get_script_args' | <p>I have been trying to install Ryu for few days but was not able to get around this error. I have been stuck for long and need to install it as soon as possible to continue working.</p>
<pre><code>fani@fani-VMware-Virtual-Platform:~/ryu$ pip install . --break-system-packages
Defaulting to user installation because no... | <python><python-3.x><sdn><ryu> | 2024-09-16 09:03:49 | 4 | 1,146 | farhan jatt |
78,989,454 | 10,451,021 | Unable to import selenium.webdriver.common.by | <p>While trying to run selenium commands in Python, I am not able to import <code>selenium.webdriver.common.by</code>. However, the library 'selenium' is finely imported. I am running the program in VS Code.</p>
<p>Script:-</p>
<pre><code>from selenium import webdriver
from selenium.webdriver.common.by import By
driver... | <python><visual-studio-code><selenium-webdriver> | 2024-09-16 08:56:00 | 0 | 1,999 | Salman |
78,989,293 | 19,369,310 | InconsistentVersionWarning: Trying to unpickle estimator StandardScaler from version 1.2.2 when using version 1.3.2 | <p>I am trying to train a machine learning model which uses the <code>PowerTransformer</code> from <code>scikit-learn</code> to transform my training data. And here is my code:</p>
<pre><code>from sklearn import preprocessing
from sklearn.preprocessing import PowerTransformer
yj = PowerTransformer(method='yeo-johnson'... | <python><scikit-learn> | 2024-09-16 08:00:37 | 1 | 449 | Apook |
78,989,286 | 10,415,129 | How to pass config options to plotly in Shiny for Python? | <p>How do I configure a <code>plotly</code> graph in shiny for Python?</p>
<p>Consider the following minimal shiny example.</p>
<pre class="lang-py prettyprint-override"><code>from shiny import ui, App
from shinywidgets import output_widget, render_widget
import plotly.express as px
import plotly.graph_objects as go
... | <python><plotly><py-shiny> | 2024-09-16 07:59:44 | 1 | 351 | Escalen |
78,989,228 | 2,864,143 | Python import from parent directory not working | <p>I have the following code structure:</p>
<pre><code>root_package/common.py - common package code imported from different submodules, tests etc.
root_package/core - core package functionality
root_package/test/test.py - tests for core
</code></pre>
<p>I have read the <a href="https://docs.python.org/3/tutorial/module... | <python><python-3.x> | 2024-09-16 07:38:18 | 1 | 960 | Student4K |
78,989,207 | 315,182 | Why is Python httpx.get or requests.get much slower than cURL for this API? | <p>For a home automation project I am trying to pull train delay data. <a href="https://v6.db.transport.rest/" rel="nofollow noreferrer">An API wrapper exists</a>, with cURL examples. These work fine, but both Python's <code>requests.get</code> and <code>httpx.get</code> are slow to pull data (up to a minute for <code>... | <python><rest><curl><python-requests><httpx> | 2024-09-16 07:28:06 | 1 | 898 | 0xDEADBEEF |
78,989,006 | 20,793,070 | aiogram 3 suddenly started giving an error | <p>I created the bot using aiogram 3.4.1 and it worked well. I left the project for two months and returned to it recently. When calling any menu, the bot gives an error:</p>
<pre><code>aiogram.exceptions.TelegramBadRequest: Telegram server says - Bad Request: can't parse entities: Unsupported start tag "" at... | <python><aiogram> | 2024-09-16 06:17:17 | 1 | 433 | Jahspear |
78,988,545 | 5,937,757 | `schemachange`, snowflake and oauth authentication in GitHub action | <p>I have been trying to use Oauth Authentication of <a href="https://github.com/Snowflake-Labs/schemachange?tab=readme-ov-file#oauth-authentication" rel="nofollow noreferrer"><code>schemachange</code></a> in my github action pipeline; however, I get the following error message</p>
<pre><code>Traceback (most recent cal... | <python><git><snowflake-cloud-data-platform><schemachange> | 2024-09-15 23:42:48 | 0 | 423 | mas |
78,988,527 | 5,775,965 | PyO3 pass mutable rust struct between Rust and Python callbacks | <p>I am trying to use Python as a scripting engine for my Rust project. I have some Rust code which calls a Python function which in turn should call some Rust functions. The problem is that there is mutable state that I need to keep track of in Rust-land.</p>
<p>The way I have it set up right now is that <code>Descrip... | <python><rust><ffi><borrow-checker><pyo3> | 2024-09-15 23:22:48 | 0 | 1,159 | genghiskhan |
78,988,482 | 7,495,123 | Custom authorization restriction in django view | <p>I have an app. The app has users, posts, comments to post etc(it's kinda blog). The task is to limit users from editing objects, that do not belong to the user. Like User can not edit posts made by another one(or comments). I want to write a decorator for it in order to authorize user's actions. So i did, but now i ... | <python><django><decorator> | 2024-09-15 22:40:37 | 1 | 1,137 | chydik |
78,988,417 | 13,498,838 | Why is await queue.get() Blocking and Causing My Async Consumers to Hang? | <p>Iβm having trouble with an asynchronous queue. Specifically, the <code>await queue.get()</code> seems to block the rest of my application, causing it to hang.</p>
<p>I came across a similar issue discussed here: <a href="https://stackoverflow.com/questions/56377402/why-is-asyncio-queue-await-get-blocking">Why is asy... | <python><asynchronous><queue><python-asyncio><fastapi> | 2024-09-15 21:50:57 | 1 | 1,454 | jda5 |
78,988,304 | 298,607 | Split on regex (more than a character, maybe variable width) and keep the separator like GNU awk | <p>In GNU awk, there is a four argument version of <a href="https://www.gnu.org/software/gawk/manual/html_node/String-Functions.html#index-split_0028_0029-function" rel="noreferrer">split</a> that can optionally keep all the separators from the split in a second array. This is useful if you <a href="https://stackoverfl... | <python><regex><ruby><algorithm><split> | 2024-09-15 20:32:14 | 2 | 104,598 | dawg |
78,988,186 | 3,163,618 | Function memoization, passing around precomputed values | <p>I have a function like this in my library, which depends on a large subset of the inputs being pre-calculated:</p>
<pre><code>@cache
def f(n, precompute):
if n < len(precompute):
return precompute[n]
# recursive calculations, which are memoized on return
return some_compute(f(n-1, precompute... | <python><memoization><functools><function-attributes> | 2024-09-15 19:26:25 | 0 | 11,524 | qwr |
78,988,118 | 4,875,641 | Python Multiprocessing - losing command prompt window | <p>I am running the following Python program to start a few processes to run simultaneously. Each process will run for several seconds. This is being started from a command prompt. But if I interrupt the execution (ctl-C) I often get a console message 'keyboard interrupt' along with a long traceback and the command pro... | <python><multiprocessing><python-multiprocessing> | 2024-09-15 18:46:04 | 3 | 377 | Jay Mosk |
78,988,099 | 14,022,262 | Increase speed of two for loops in Python | <p>I have a double for loop in a Python code. I want to increase the execution speed, but the matrix is built using data from the previous row and column. How can I achieve this?</p>
<pre><code>import numpy as np
num_rows, num_cols = 100, 5
matrix = np.zeros((num_rows, num_cols))
matrix[0, :] = np.random.rand(num_co... | <python><for-loop> | 2024-09-15 18:36:29 | 4 | 531 | Vinicius B. de S. Moreira |
78,988,010 | 17,729,094 | Explode multiple columns with different lengths | <p>I have a dataframe like:</p>
<pre><code>data = {
"a": [[1], [2], [3, 4], [5, 6, 7]],
"b": [[], [8], [9, 10], [11, 12]],
}
df = pl.DataFrame(data)
"""
βββββββββββββ¬ββββββββββββ
β a β b β
β --- β --- β
β list[i64] β list[i64] β
βββββββββββββͺβββββββ... | <python><dataframe><python-polars> | 2024-09-15 17:45:39 | 2 | 954 | DJDuque |
78,987,980 | 67,579 | How do calls of models.Manager and custom managers work? | <p>The following question was <a href="https://stackoverflow.com/q/78833708/67579">asked by a different user</a> that subsequently removed the question. But I think it is useful to "dig" a bit in how Django's manager logic works.</p>
<blockquote>
<p>I extended the <code>models.Manager</code> class and created... | <python><django><django-managers> | 2024-09-15 17:31:49 | 1 | 481,621 | willeM_ Van Onsem |
78,987,882 | 10,430,394 | Is pathlib.Path.read_text() better than _io.TextIOWrapper.read()? | <p>I've recently discovered that <code>pathlib</code> offers some methods for dealing with file paths. When looking through the list of methods, <code>.read_text()</code> caught my attention. It implied that I could keep an object of type <code>Path</code> that stores a bunch of useful info in one neat package as well ... | <python><pathlib> | 2024-09-15 16:53:47 | 1 | 534 | J.Doe |
78,987,822 | 4,875,641 | Python Multiprocessing - is it creating two threads per process | <p>This program starts two processes. It appears that there may actually be two threads created for each process. One, which is the mainline code of the spawned python program and the other being the execution of the function that was called to start the process. The program output shows that both the mainline of the ... | <python><multiprocessing><python-multiprocessing> | 2024-09-15 16:21:40 | 1 | 377 | Jay Mosk |
78,987,693 | 11,747,861 | polars: how to find out the number of columns in a polars expression? | <p>I'm building a package on top of Polars, and one of the functions looks like this</p>
<pre class="lang-py prettyprint-override"><code>def func(x: IntoExpr, y: IntoExpr):
...
</code></pre>
<p>The business logic requires that x can include multiple columns, but y must be a single column.</p>
<p>What should I do to ... | <python><python-polars> | 2024-09-15 15:11:09 | 2 | 2,757 | Mark Wang |
78,987,685 | 2,754,510 | Abnormal interpolating spline with odd number of points | <p>I have implemented a cubic B-Spline interpolation, not approximation, as follows:</p>
<pre><code>import numpy as np
import math
from geomdl import knotvector
def cox_de_boor( d_, t_, k_, knots_):
if (d_ == 0):
if ( knots_[k_] <= t_ <= knots_[k_+1]):
return 1.0
return 0.0
... | <python><numpy><interpolation><spline> | 2024-09-15 15:06:49 | 1 | 3,276 | Constantinos Glynos |
78,987,427 | 3,565,923 | Mocking pytest test with @patch unittest.mock decorator | <p><strong>Issue with Mocking <code>send_request()</code> in Unit Tests</strong></p>
<p>I'm having trouble with mocking the <code>send_request()</code> function in my tests. Despite using <code>patch</code>, the original <code>send_request()</code> function is being called, and the mock isn't applied. Here's the releva... | <python><mocking><python-unittest><patch> | 2024-09-15 12:56:27 | 1 | 350 | user3565923 |
78,987,084 | 14,517,452 | How to use ctypes.memmove on memoryview objects in regular python | <p>First let me state the context for this issue. I'm using PySide6 to capture the screen, and I want to intercept the video feed and perform some image processing on the frames using opencv. I am able to collect a QVideoFrame, convert to QImage, then convert that to a numpy array and do my image processing. However, I... | <python><ctypes><pyside6> | 2024-09-15 09:55:00 | 1 | 748 | Edward Spencer |
78,986,977 | 12,415,855 | How can I close and open a new window? | <p>I try to close and open a windows using PyQt5 and the following code:</p>
<pre class="lang-py prettyprint-override"><code>import PyQt5.QtWidgets as qtw
from PyQt5 import uic
import sys
import os
class Window2(qtw.QMainWindow):
def __init__(self):
super().__init__()
uic.loadUi("window2.ui",self)
... | <python><pyqt5> | 2024-09-15 09:05:17 | 1 | 1,515 | Rapid1898 |
78,986,910 | 4,466,240 | FastAPI endpoint does not generate swagger doc for body parameter created without using Model | <p>I have an API endpoint in FastAPI wherein I'm <strong>not</strong> using Models to access request body. I'm instead using the built-in type <code>Body</code> with a description.</p>
<pre class="lang-py prettyprint-override"><code>@vault_router('/secret')
def get_secret(
token: Annotated[str, Header(description=&... | <python><model><fastapi><pydantic> | 2024-09-15 08:20:46 | 1 | 724 | Ritik Saxena |
78,986,801 | 14,472,571 | ImportError: cannot import name 'Iterator' from 'typing_extensions' (/databricks/python/lib/python3.10/site-packages/typing_extensions.py) | <p>I'm facing the following issue on Azure Databricks when trying to import <code>from openai import OpenAI</code> after installing <code>openai</code>.</p>
<p>Here's the error:</p>
<pre><code>ImportError: cannot import name 'Iterator' from 'typing_extensions' (/databricks/python/lib/python3.10/site-packages/typing_ext... | <python><databricks><azure-databricks><openai-api> | 2024-09-15 07:06:46 | 1 | 2,778 | The Singularity |
78,986,747 | 17,889,492 | Sympy solve solutions missing | <p>Sympy's <code>solve</code> method doesn't return all solutions on this relatively simple problem:</p>
<pre><code>import sympy as sp
y1, y2, x = sp.symbols('y1 y2 x')
y1 = x**2
y2 = x
sp.solve(y1, y2, dict = True)
</code></pre>
<p>This returns <code>[{x: 0}]</code> but there should be an <code>x=1</code> solution a... | <python><sympy><symbolic-math> | 2024-09-15 06:27:50 | 2 | 526 | R Walser |
78,986,621 | 9,855,588 | pydantic collect all failed validations from field_validator | <p>Here a few field validators using Pydantic v2, but the behavior I'm experiencing is that the <code>field_validator</code> will return an error immediately instead of running all field validations and returning all field errors
with the record being validated. This is probably expected, but I'm wondering if it's poss... | <python><python-3.x><pydantic-v2> | 2024-09-15 04:24:31 | 1 | 3,221 | dataviews |
78,986,437 | 4,529,605 | Add variable "monthly" increments to a datetime column in pandas using another column | <p>I have the following dataset and I simply want to add the monthly increments (from a column within the dataframe) to my date column (another column in my dataframe).</p>
<pre><code>index monthly_increment date
0 1 2018-12-01
1 2 2018-10-01
2 3 2018-1... | <python><pandas><date-manipulation> | 2024-09-15 01:14:11 | 2 | 405 | Gobryas |
78,986,411 | 3,855,264 | How to diagnose a serial communication crash that happens randomly and very seldom? | <p>I'm connecting to a Lakeshore 336 Temperature controller from Linux Mint via pyserial. My app works relatively well and has operated for months at a time without error. However, it sometimes happen that the device in question stops responding generating the following error message:</p>
<p><em>device reports readines... | <python><mutex><pyserial> | 2024-09-15 00:45:55 | 0 | 308 | Alexis R Devitre |
78,986,341 | 6,618,225 | VLOOKUP in Python Pandas | <p>A question that has been asked similarly a million times but I cannot find the correct answer that applies to my case.
I have two excel files that I want to join like an Excel VLOOKUP.</p>
<p>File A already has the columns already created and they are <strong>partially</strong> filled (or empty). There is one column... | <python><pandas> | 2024-09-14 23:28:49 | 2 | 357 | Kai |
78,986,294 | 14,250,641 | Accurately Compute Overlapping and Non-Overlapping Genomic Intervals Across Two DataFrames in Python | <p>I want the <em>exact</em> intervals of DF1 that overlap with DF2. Also, I want the intervals that do not overlap with DF2. This is tricky because you must include A) the DF1 rows that are not overlapping at all B) the DF1 rows that overlap partially.</p>
<p>You can see in the first row of DF1 and DF2, there is overl... | <python><pandas><dataframe><bioinformatics><pyranges> | 2024-09-14 22:42:36 | 1 | 514 | youtube |
78,985,935 | 1,479,670 | python calling executable with popen;, file written by executable can not be accessed | <p>I have a C++ file</p>
<pre><code>#include <cstdio>
int main(int iArgC, char *apArgV[]) {
int iResult = -1;
if (iArgC > 1) {
FILE *fOut = fopen(apArgV[1], "wt");
if (fOut != NULL) {
fprintf(fOut, "hello\n");
fprintf(fOut, "goodbye\n&qu... | <python><subprocess> | 2024-09-14 19:03:29 | 1 | 1,355 | user1479670 |
78,985,781 | 15,662,114 | How to fix this python import shadowing problem? | <h2>Problem Overview</h2>
<p>I'm facing an import shadowing problem with a python 3.12 project that uses google protobuf.</p>
<p>Below is the structure of my project.</p>
<pre class="lang-none prettyprint-override"><code>Project
βββ proto (generated by protoc)
β βββ google
β β βββ api
β β βββ ...
β βββ ... | <python><protocol-buffers> | 2024-09-14 17:48:03 | 1 | 646 | dw218192 |
78,985,764 | 9,381,966 | How to access checkout session metadata in Stripe webhook for payment methods in subscription mode | <p>I'm integrating Stripe Checkout in a Django application and handling webhooks to update user information based on payment events. However, I'm encountering issues accessing metadata associated with a <code>Checkout Session</code> when dealing with <code>payment_method</code> objects.</p>
<h3>Context:</h3>
<p>I have ... | <python><django><stripe-payments> | 2024-09-14 17:38:43 | 1 | 1,590 | Lucas |
78,985,516 | 3,801,449 | How to automatically download or warn about a non-PyPi dependency of a Python package? | <p>I have a Python package, which is distributed on PyPi. It depends on number of other packages available on PyPi and on <a href="https://psicode.org/" rel="nofollow noreferrer">Psi4</a>, which is only distributed on Conda repositories (<a href="https://anaconda.org/psi4/psi4" rel="nofollow noreferrer">https://anacond... | <python><pypi><python-packaging><hatch> | 2024-09-14 15:41:21 | 1 | 3,007 | Eenoku |
78,984,852 | 8,179,672 | Renumerate a column in a group | <p>I'm looking for a scalable way to re-numerate groups (in my case cluster number) in a column. Below the current state with Pandas schema.</p>
<pre><code>data = [
["Adam", 1, 22],
["Eddy", 0, 22],
["Boby", 9, 22],
["Timy", 2, 26],
["Carl", 9, 26],
... | <python><pandas><dataframe> | 2024-09-14 10:07:03 | 2 | 739 | Roberto |
78,984,714 | 6,345,936 | How to use asyncio gather with sqlalchemy session in FastAPI and the workaround | <p>I am trying to make an asynchronous call using asyncio gather to call multiple database query. I am getting error</p>
<pre><code>sqlalchemy.exc.IllegalStateChangeError: Method 'close()' can't be called here; method '_connection_for_bind()' is already in progress and this would cause an unexpected state change to <... | <python><sqlalchemy><python-asyncio> | 2024-09-14 09:01:03 | 1 | 695 | kusiaga |
78,984,536 | 1,388,799 | Why does this tkinter image animation not delay properly? | <p>Here's my attempt, modified from another post, to create a <em>minimal</em> loop where I create a numpy array and display it. (For convenience I have a Start button.)</p>
<p>It works fine, with one exception -- it runs at full speed, regardless of what delay I put in as the first argument to self.after (it's 1000 in... | <python><numpy><tkinter> | 2024-09-14 07:30:55 | 1 | 359 | Walt Donovan |
78,984,405 | 7,516,523 | Find duplicate "group of rows" in pandas DataFrame | <p>How can I find duplicates of a group of rows inside of a DataFrame? Or in other words, how can I find the indices of a specific duplicated DataFrame inside of a larger DataFrame?</p>
<p>The larger DataFrame:</p>
<div class="s-table-container"><table class="s-table">
<thead>
<tr>
<th>index</th>
<th>0</th>
<th>1</th>
... | <python><pandas><dataframe><indexing><duplicates> | 2024-09-14 05:59:47 | 3 | 345 | Florent H |
78,984,342 | 14,250,641 | Find non-overlapping intervals within DNA coordinates | <p>I am trying to find the non-overlapping intervals for the start/end DNA coordinates (on the same chromosome). I am having a hard time developing a function that takes into account two rows on the same exon. The non-overlapping interval must be unique (not overlap with any other intervals).</p>
<p>For ex, on the firs... | <python><pandas><dataframe><bioinformatics> | 2024-09-14 05:01:47 | 2 | 514 | youtube |
78,984,299 | 11,141,816 | How to run an interactive Julia session in python without using the python's julia library? | <p>I want to use python to send command to julia and then get string output as the return and then send the command again. i.e. <code>x=2</code> and then <code>x+1</code> return <code>3</code>. This required an interactive session through subprocess. I tried the <code>subprocess.Popen(["julia", "-e"... | <python><julia><subprocess><interactive> | 2024-09-14 04:27:11 | 0 | 593 | ShoutOutAndCalculate |
78,984,259 | 2,210,825 | Consens sequence of list of strings as multiple sequence alignment? | <p>I'm working on a program whose goal is to make a playlist that "flows" nicely. To do this, I obtain for each song a list of the genres it belongs to from Spotify. I've assumed that the order of this list heuristically goes from "bigger" genres to "nicher" genres. Effectively, my data st... | <python><bioinformatics><spotify><sequence-alignment> | 2024-09-14 03:58:52 | 1 | 1,458 | donkey |
78,984,164 | 11,573,887 | Accessing BigQuery Dataset from a Different GCP Project Using PySpark on Dataproc | <p>I am working with BigQuery, Dataproc, Workflows, and Cloud Storage in Google Cloud using Python.</p>
<p>I have two GCP projects:</p>
<ul>
<li><p><strong>gcp-project1:</strong> contains the BigQuery dataset <strong>gcp-project1.my_dataset.my_table</strong></p>
</li>
<li><p><strong>gcp-project2:</strong> contains my <... | <python><apache-spark><google-bigquery><google-cloud-dataproc> | 2024-09-14 02:28:55 | 1 | 386 | Henry Xiloj Herrera |
78,983,916 | 4,921,103 | Implementing Discriminated Unions in Pydantic without using Nested Models? | <p>I'm trying to implement discriminated unions in Pydantic to select the correct class based on user input using the <code>discriminator</code> parameter. While the <a href="https://docs.pydantic.dev/latest/concepts/unions/#discriminated-unions-with-str-discriminators" rel="nofollow noreferrer">documentation</a> sugge... | <python><pydantic> | 2024-09-13 22:34:18 | 1 | 48,014 | Rahul Gupta |
78,983,898 | 856,804 | how to fix `"Series[Any]" not callable [operator]` mypy error | <p>For the code below</p>
<pre><code>import pandas as pd
df_data = pd.DataFrame(
[
{"a": 2, "b": 1},
{"a": 2, "b": 10},
{"a": 3, "b": 77},
]
)
df_data.groupby("a").size().to_frame("size")
</code></pre>
<p>... | <python><pandas><python-typing><mypy> | 2024-09-13 22:22:17 | 0 | 9,110 | zyxue |
78,983,868 | 17,729,094 | Keep only rows that have at least one null | <p>I am trying to do basically the opposite of <code>drop_nulls()</code>. I want to keep all rows that have at least one null.</p>
<p>I want to do something like (but I don't want to list all other columns):</p>
<pre class="lang-py prettyprint-override"><code>for (name,) in (
df.filter(
pl.col("a"... | <python><dataframe><python-polars> | 2024-09-13 22:07:20 | 1 | 954 | DJDuque |
78,983,752 | 367,181 | Internationalization on the server side (changing languages dynaimcally mutliple times per second with gettext) | <p>I am working on a websocket server in python (FastAPI) which will work with multiple connected clients over websockets. The server is exchanging JSON messages with the clients. Some of the JSONs outputted by the server are UI-related i.e. they may include text messages which are then shown to the user in the client ... | <python><internationalization><client-server><gettext> | 2024-09-13 21:06:30 | 0 | 6,332 | PawelRoman |
78,983,656 | 20,302,906 | Unittest can't find imported module in imported module | <p>Unittest modules import issue</p>
<p>My project folder structure goes like this:</p>
<pre><code>project/
__init__.py (empty)
tests/
__init__.py (empty)
tests.py
src/
__init__.py
a.py
b.py
c.py
</code></pre>
<p><em>tests/tests.py</em></p>
<pre class="lang-py prettyprint-override"><... | <python><python-unittest> | 2024-09-13 20:25:54 | 1 | 367 | wavesinaroom |
78,983,396 | 4,444,757 | TypeError: MetaTrader5.initialize() missing 1 required positional argument: 'self' only in linux not in windows | <p>I have seen the following posts (<a href="https://stackoverflow.com/questions/17534345/why-do-i-get-typeerror-missing-1-required-positional-argument-self">-</a> <a href="https://stackoverflow.com/questions/75362227/missing-1-required-positional-argument-self">-</a> <a href="https://stackoverflow.com/questions/17534... | <python><linux><metatrader5> | 2024-09-13 18:43:45 | 0 | 1,290 | Sadabadi |
78,983,184 | 5,560,898 | Selenium Invalid Selector Exception | <p>I am trying to click a button on a page.</p>
<pre class="lang-html prettyprint-override"><code><div class="button mt-8 text-center md:mt-12 lg:mt-16">
<button class="cmp-button spacing-t-none spacing-b-none min-w-[12rem] justify-center bg-beige-200 text-black" type="button"... | <python><selenium-webdriver> | 2024-09-13 17:25:41 | 1 | 3,572 | Chicken Sandwich No Pickles |
78,983,171 | 11,244,991 | How to use cloud functions to create a document in Firebase Cloud Storage | <p>I have created a Python cloud function to create a new document in Cloud Storage. It works well with firebase emulators:start, but I get an error when trying to call it from my application:</p>
<blockquote>
<p>cloud-function.ts:20 Error executing cloud function upload_html_page FirebaseError: unauthenticated</p>
</b... | <javascript><python><typescript><firebase><google-cloud-functions> | 2024-09-13 17:23:38 | 1 | 801 | Kantine |
78,983,089 | 12,904,419 | Install `venv` without sudo access | <p>I am in a Ubuntu 22.04 cluster with <code>Python==3.11</code> and <code>pip==24.2</code> and no sudo access. When I try to create a virtual environment <code>python3 -m venv .env</code> I get:</p>
<pre class="lang-none prettyprint-override"><code>The virtual environment was not created successfully because ensurepip... | <python><python-venv> | 2024-09-13 16:55:01 | 1 | 962 | ABarrier |
78,983,053 | 6,843,153 | Create pydantic computed 2.0 computed_field like field on pydatinc 1.10 | <p>I am using <strong>Pydantic 1.10</strong> and I want to define computed fields in my model so I researched and found <a href="https://docs.pydantic.dev/2.0/usage/computed_fields/" rel="nofollow noreferrer">this do</a>c about <strong>Pydantic 2.0</strong> about computed_field decorator. The problem is that I can't fi... | <python><pydantic> | 2024-09-13 16:44:47 | 1 | 5,505 | HuLu ViCa |
78,982,936 | 4,436,517 | Why are marginals from scipy.linprog(method='highs') -0.? | <p>Please find code, output, and package versions below.</p>
<p>I was under the impression that the <code>r.eqlin.marginals</code> array returned from <code>scipy.optimize.linprog</code> represents how much the cost function changes with respect to a small change in the equality constraints. In my example I have two eq... | <python><scipy><highs> | 2024-09-13 16:10:48 | 0 | 1,159 | rindis |
78,982,732 | 7,253,901 | Extracting data from two nested columns in one dataframe | <p>I have a pandas dataframe that contains transactions. A transaction is either booked as a payment, or a ledger_account_booking. A single transaction can have <em>multiple</em> payments and/or <em>multiple</em> ledger account bookings. Therefore, my columns <code>payments</code> and <code>ledger_account_bookings</cod... | <python><pandas><dataframe> | 2024-09-13 15:10:42 | 2 | 2,825 | Psychotechnopath |
78,982,686 | 1,870,832 | Filter polars dataframe on records where column values differ, catching nulls | <p><strong>Have:</strong></p>
<pre><code>import polars as pl
df = pl.DataFrame({'col1': [1,2,3], 'col2': [1, None, None]})
</code></pre>
<p>in polars dataframes, those <code>None</code>s become <code>null</code>s:</p>
<pre><code>> df
ββββββββ¬βββββββ
β col1 β col2 β
β --- β --- β
β i64 β i64 β
ββββββββͺβββββββ‘
β 1... | <python><dataframe><python-polars> | 2024-09-13 14:57:35 | 2 | 9,136 | Max Power |
78,982,506 | 2,925,620 | pyqtgraph: LegendItem offset returns false values regardless of position | <p>I have a Qt5 window with a pyqtgraph in a dynamic situation, i.e., plots, axes, curves can be added or modified. Also, the legend can be shown and hidden. Since the user can also drag the legend to a different place using the mouse, I would like to store its position and perhaps restore this position later. Setting ... | <python><pyqtgraph> | 2024-09-13 14:10:01 | 1 | 357 | emma |
78,982,423 | 17,729,094 | How to propagate `null` in a column after first occurrence? | <p>I have 2 data sets:</p>
<p>The first one describes what I expect:</p>
<pre class="lang-py prettyprint-override"><code>expected = {
"name": ["start", "stop", "start", "stop", "start", "stop", "start", "stop"],
"desc... | <python><dataframe><python-polars> | 2024-09-13 13:50:20 | 1 | 954 | DJDuque |
78,982,236 | 12,485,858 | Making Python script running in a shell terminal read stdin from another shell instance | <p>I have a python script which reads and input when provided and does something with the input (see process_input below):</p>
<pre><code>import sys
def process_input(input_data):
# logic to process the input data
print(f"Processed input: {input_data}")
return 1 # Return 1 to increment the counter
... | <python><shell><ipc> | 2024-09-13 12:56:08 | 1 | 846 | teoML |
78,982,004 | 6,439,229 | How to get stretch factor for QSpacerItems | <p>When you <code>addStretch()</code> or <code>insertStretch()</code> to a <code>QBoxLayout</code>, a <code>QSpacerItem</code> is added/inserted to the layout and you can set the stretch factor while doing so.</p>
<p>Now I would like to retrieve that stretch factor from the SpacerItem but I can't find how to do so.<br ... | <python><spacing><pyqt6><qboxlayout> | 2024-09-13 11:45:29 | 1 | 1,016 | mahkitah |
78,981,908 | 8,801,862 | Application type API permission with Microsoft Graph API | <blockquote>
<p>I want to create an app that will list all my emails in Outlook via Microsoft Graph API.</p>
</blockquote>
<p>What I did:</p>
<p>1)</p>
<ul>
<li>Go to "Microsoft Entra ID" (former Active Directory)</li>
<li>Head to "App registrations" -> "New registration"</li>
<li>Selec... | <python><json><web-scraping><outlook><microsoft-graph-api> | 2024-09-13 11:15:48 | 1 | 401 | user13 |
78,981,868 | 13,443,954 | How to escape backslash loads from dotenv json variable python | <p>I have a dotenv variable saved into .env file (in json format).
Example:</p>
<pre><code>my_env_variable = '{"ip": "xx.xx.xxx.xxx",
"user": "my\user",
"password": "password"}'
</code></pre>
<p>Reading this variable form my .py script (connection ... | <python><json><dotenv> | 2024-09-13 11:03:48 | 2 | 333 | M AndrΓ‘s |
78,981,779 | 21,049,944 | Multiple dataframe logs into one node using python bigtree | <p>I would like to use bigtree to transform my polars/pandas dataframe to a tree in the following way.
My data looks something like this:</p>
<pre><code>id, parrent, val1, val2
1, 0, ..., ...
1, 0, ..., ...
1, 0, ..., ...
2, 1, ..., ...
2, 1, ..., ...
3, 1, ..., ...
3, 1, ..., ...
3, 1, ..., ...
4, 2, .... | <python><pandas><dataframe><tree> | 2024-09-13 10:37:22 | 1 | 388 | Galedon |
78,981,714 | 3,941,955 | How can I apply one time pad on a sound waveform file, assuming a same size key is distributed on both sides? | <p>I am looking for a way to apply OTP on a sound waveform if possible.
Some questions emerged before I ever started.</p>
<p>Can I XOR a text file of the same size, with the waveform to produce a ciphertext that can be then xored back to the original sound, using the same text file?
Is it as effective or is it better ... | <python><python-3.x><encryption><one-time-pad> | 2024-09-13 10:20:00 | 0 | 466 | George Eco |
78,981,683 | 1,685,729 | Error installing trottersuzuki package in venv. numpy not found error even though it is there | <p>It says numpy not installed even though it is installed. I thought may be the venv is not accessible to pip (which it should be, because numpy is installed inside the venv) and I installed it system wide using <code>sudo apt install python3-numpy</code> as you can see in the very last of the following snippet.</p>
<... | <python><numpy><pip><package> | 2024-09-13 10:12:32 | 2 | 727 | vanangamudi |
78,981,590 | 1,728,502 | Azure Function with Blob Trigger Running with InputStream but not with BlobClient Parameter | <p>I'm trying to get a blob-triggered Azure Function to work. I got the samples to run, and am all set up with my local development AzureWebJobsStorage connection string set up to use Azurite. I am testing by adding a file using Azure Storage Explorer.</p>
<p>This function triggers and my code is run:</p>
<pre><code>... | <python><azure-functions><azure-blob-storage><azure-blob-trigger><azure-triggers> | 2024-09-13 09:48:28 | 1 | 315 | Rich |
78,981,469 | 1,145,666 | Can I create a method that returns a value, or yields data, based on a switch? | <p>I have this method:</p>
<pre><code>def fetch_rows(connection, return_cursor = False):
query = f"""SELECT ... """
cur = connection.cursor(cursor_factory=psycopg2.extras.RealDictCursor)
cur.execute(query)
if return_cursor:
return cur
else:
info(f"... | <python><generator> | 2024-09-13 09:14:09 | 0 | 33,757 | Bart Friederichs |
78,981,438 | 4,718,423 | unittest class init mock exception raised | <pre><code>#!/usr/bin/env python3
import unittest
from unittest.mock import patch
class User(object):
def __init__(self):
self.__name = None
self.__authorised_users = ["me", "you"]
local_input = input("please provide your windows 8 character lower case login: "... | <python><unit-testing><patch> | 2024-09-13 09:04:16 | 1 | 1,446 | hewi |
78,981,280 | 5,989,438 | django after submit login info, does not lead to intended detail view page | <p>I don't know what to do here after a few days of trying different ideas. After I submit the the prop login email and password, the page does not do anything. It just says "Invalid password". I am not sure my login view is connected to the <code>sqllite</code>. I am thinking my mistake is where the login ... | <python><django><authentication><view><django-views> | 2024-09-13 08:23:30 | 1 | 309 | fishtang |
78,981,172 | 13,250,589 | convert a polars.DataFrames of List[Struct[2]] to a dict of polars.DataFrame | <p>I have a single row <code>polars.DataFrame</code> <code>df</code> with schema</p>
<pre class="lang-py prettyprint-override"><code>df.schema
>>> Schema([('S1',
List(Struct({'S1': Float64, 'timestamp': Datetime(time_unit='us', time_zone=None)}))),
('S2',
List(Struct({'S2': Float64, ... | <python><dataframe><python-polars> | 2024-09-13 07:51:02 | 1 | 885 | Hammad Ahmed |
78,981,088 | 1,838,076 | Is there a way to print incremental time instead of absolute time with Python logging | <p>When using Python logging, <code>asctime</code> is very handy in looking at the hotspots in code. However, I have to decode or post-process the log to show incremental time taken between each log message.</p>
<pre><code>logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
</cod... | <python><logging><python-logging> | 2024-09-13 07:21:53 | 2 | 1,622 | Krishna |
78,981,052 | 1,125,062 | Pytorch incorrect results with non_blocking assignment from Cuda to CPU | <p>I'm trying to assign a tensor on CPU with values I just obtained from GPU, however getting incorrect results, both tensors should be the same obviously:</p>
<p>(To avoid any unnecessary chatter, I'd like to mention beforehand that I'm also aware of exactly <em><strong>two</strong></em> other different methods of cop... | <python><python-3.x><pytorch><nonblocking> | 2024-09-13 07:10:08 | 2 | 4,641 | Anonymous |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.