Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Posts by mr Tsjolder
Can anyone explain to me why my Haskell function gives rise to a type-definition error? Originally, I wrote the following function to subtract one from the first n elements in a list: dec_first :...
I am writing a Python package where I have two classes in different files that (indirectly) depend on each other. If I wouldn't care about type-hints, there would be no problem, but unfortunately,...
The map operation is a typical concept from the functional programming paradigm. However, side-effects are a typical example of something that does not fit functional programming well. As a resul...
I have created a tag in my project, using git tag v2023 However, I forgot to commit a few changes. Now I would like to move this tag to the current point (after having committed the changes I had...
I am working on a toy project where I have a container for which I would like to write an iterator that iterates over the values in the container. Because the values are stored in a (c-style) arra...
I eventually also found out that the typing module has a global variable TYPE_CHECKING that can be used to only import during type-checking. Concretely, the following code for helpers.py seems to ...
After a few years of casually using stack-exchange sites and wandering around on coda-dict, I feel there are mainly three components to the quality of the content on each of these sites: the kno...
Assuming that dynamicmodel and uncertainlibrary are just (nested) dictionaries and value = '["SCD"]["CL0"]' is actually supposed to be a string (note the single quotes here), your code would at...
Not sure if this is the right place to ask, but I am trying to understand the reported theoretical performance of tensor cores on NVIDIA GPUs. Taking the H100 SXM5 as example, the reported peak pe...
Your suspicion is right that PyTorch relies heavily on (hidden) global states. In your specific example, loss.backward() computes (all) gradients and accumulates them directly in the grad attribut...
You can use the carriage return control character "\r" to return to the beginning of the line and overwrite text. When using the print function you additionally have to make sure not to write the ...
I just noticed this question about data structures in the Q&A. Although algorithms and data structures are often (part of) a solution to a problem when writing software, this question is const...
It seems like what you want to do can be achieved by using data.assign_coords(t=[0.123]) The error message is extremely confusing in this respect, but it seems like the new value for the coordi...
A few thoughts from my side (as a ML researcher, without experience in LLMs): I am not sure if it is really useful to block ChatGPT specifically. ChatGPT is only one of many LLMs out there. ...
Since pandas uses numpy for these computations under the hood, I would have suggested to use df.mean(keepdims=True), but apparently this has been explicitly disabled by pandas. However, after look...
It turns out there is a distinction between the API (i.e. the CUDA docs) and the actual implementation. In the Hopper whitepaper that is linked in the question (h100 SXM5), the implementation deta...
One option is to write a (parameterised) decorator that transforms your jitter function with a given percentage value: from typing import Callable def percent_jitter_dec(percentage: float = 0.2...
This should be possible using np.array as indicated in the Notes of the tolist docs
Each rule in the Makefile represents a single target. This means that your first makefile has a single target: obj/library.o. I guess that if there is only one target, make assumes that this is the...
I believe one of the main strengths of Q&A websites is that they provide a more digestible alternative to dense documentation. Especially for programmers who do not yet know how to find/use th...
First of all, the standard keystroke for interrupting a CLI program would be ctrl + C or whatever the windows equivalent is. Therefore, you will get the most consistent user experience if you use ...
If you are on C++11 (or newer), it should be possible to use variadic templates to write a simple (compile-time) function to count the number of arguments: template<typename... Ts> constexp...
I used to have some testing code for mocking a simple directory structure when working with pathlib. I recently tried to run these tests to learn that some of the internals in pathlib have changed ...
The following expression should capture the {dp|gp}/$ID part: https://www\.amazon\.com/([gd]p/[A-z0-9]{10}) A quick explanation: the \. are there to match periods only (otherwise it would ma...
Not sure if this is really a coding question (maybe the ML or AI Tech proposals might be better suited). Not having distinct begin and end tokens is not that extraordinary. E.g. the GPT-2 tokeniz...
