今日已更新 31 条资讯 | 累计 29765 条内容
关于我们

标签:#p

找到 12332 篇相关文章

开发者

PyTorch `permute` vs `transpose`: What's the Difference (and the `reshape` Bug That Scrambles Your Images)

You loaded an image, got a tensor shaped (batch, height, width, channels) , and your convolution wants (batch, channels, height, width) . Stack Overflow says permute . Someone else says transpose . And reshape(2, 3, 28, 28) gives you the right shape too — so why is everyone making this complicated? Because two of those three are the same tool, and the third one silently destroys your data. The short answer transpose(dim0, dim1) swaps exactly two dimensions. permute(...) reorders all of them in one call, and you must list every dimension. transpose is a special case of permute . Both return a view — no data is copied, only the strides change — which also means both leave you with a non-contiguous tensor. reshape is not in this family at all. It reinterprets the flat memory under a new shape without moving anything, so it can produce the shape you asked for while completely scrambling what the numbers mean. import torch t = torch . arange ( 24 ). reshape ( 2 , 3 , 4 ) print ( t . transpose ( 0 , 1 ). shape ) # torch.Size([3, 2, 4]) — swapped dims 0 and 1 print ( t . permute ( 2 , 0 , 1 ). shape ) # torch.Size([4, 2, 3]) — full reorder transpose — swap two axes transpose(dim0, dim1) takes two dimension indices and swaps them. Everything else stays put. t = torch . arange ( 24 ). reshape ( 2 , 3 , 4 ) print ( t . shape ) # torch.Size([2, 3, 4]) print ( t . transpose ( 0 , 1 ). shape ) # torch.Size([3, 2, 4]) print ( t . transpose ( 1 , 2 ). shape ) # torch.Size([2, 4, 3]) The order of the two arguments doesn't matter — t.transpose(0, 1) and t.transpose(1, 0) are the same thing. A swap is a swap. On a 2-D tensor this is the matrix transpose you already know, and .T is the shorthand: m = torch . arange ( 6 ). reshape ( 2 , 3 ) print ( m . T . shape ) # torch.Size([3, 2]) print ( m . transpose ( 0 , 1 ). shape ) # torch.Size([3, 2]) — identical One caution on .T : on tensors with more than two dimensions, .T reverses every dimension, and modern PyTorch has deprecated that

2026-08-03 原文 →
AI 资讯

I built 80+ free browser tools — no signup, no ads, no paywalls (here's what I learned)

A few months ago I got frustrated. I needed to compress a PDF quickly. Found a tool online — it asked me to create an account first. Found another — it had so many ads the actual button was invisible. Found a third — it uploaded my file to their servers and I had no idea what happened to it after. I thought: this shouldn't be this hard. So I built EazyStudio — a suite of 80+ browser-based tools where everything runs 100% in your browser, no signup, no intrusive ads, no files ever leaving your device. What's inside Here's a snapshot of what's available: PDF tools Compress, merge, split, rotate PDFs PDF to Word, Excel, JPG and back Add watermarks, protect with passwords Image tools Background remover (runs locally in browser) Image compressor, resizer, converter AI image upscaler Color palette extractor, color picker Developer utilities JSON formatter/validator Base64 encode/decode URL encoder, HTML entity converter Regex tester JWT decoder API tester (Postman-lite) CSS gradient generator, box shadow generator Finance & math EMI calculator, SIP calculator GST calculator, compound interest, tip splitter Unit converters (length, weight, temperature, data) And more QR code generator Password generator Text tools (word counter, case converter, lorem ipsum) Device preview tool The technical approach: browser-first The biggest design decision was: nothing gets uploaded to a server. For PDF operations I use PDF.js and pdf-lib running in the browser. For image tools it's canvas + WebAssembly (WASM) modules. For background removal I'm using a WASM-based segmentation model that loads client-side. This has three benefits: Speed — no upload round-trip, works on large files instantly Privacy — your files never touch my server Cost — zero storage, zero egress bandwidth The downside: WASM modules add initial load time. I worked around this with lazy-loading — the WASM only loads when you first use that specific tool. What I learned building this 1. People hate signups more than I ex

2026-08-03 原文 →
AI 资讯

Building Laravel NATS: A Modern, Production-Ready NATS Integration for Laravel

Building Laravel NATS: A Modern, Production-Ready NATS Integration for Laravel When building distributed systems, one of the biggest challenges is enabling services to communicate reliably without creating tight coupling. Laravel has excellent support for queues, events, broadcasting, and jobs, but when it comes to NATS , the ecosystem has been relatively limited. That's exactly why I built Laravel NATS . Instead of being just another wrapper around an existing PHP client, Laravel NATS aims to provide a Laravel-first developer experience while exposing the full power of NATS for modern event-driven architectures. In this article I'll explain: Why I built Laravel NATS Why you should consider NATS How Laravel NATS works Features that make it production ready Code examples Real-world use cases What makes this package different from existing solutions What is NATS? NATS is a lightweight, high-performance messaging system designed for cloud-native applications. Unlike traditional queues, NATS focuses on: Extremely low latency High throughput Simple publish/subscribe messaging Request/Reply APIs JetStream persistence Horizontal scalability Instead of applications calling each other directly: Order Service │ ▼ Notification Service Applications publish events: Order Service │ ▼ NATS Server │ │ ▼ ▼ Email Analytics Every service becomes independent. Why Laravel Needed a Better NATS Package Most existing packages expose the underlying PHP client almost directly. That means developers still have to understand: client lifecycle connections serialization subscriptions queue consumers JetStream APIs Laravel developers expect something different. We are used to APIs like: Cache :: put (); Queue :: push (); Event :: dispatch (); The goal of Laravel NATS was to make NATS feel just as natural. Installing Laravel NATS Installation is straightforward. composer require zaeem2396/laravel-nats php artisan vendor:publish --tag = nats-config Then configure your environment: NATS_HOST=127.0.0

2026-08-03 原文 →
AI 资讯

How to build an MCP server, step by step

Short answer To build an MCP server: install an official MCP SDK, declare your tools with typed inputs, optionally expose resources and prompts, run the server over stdio or HTTP, then connect an MCP client like Claude and test it. A minimal Python server is about ten lines; the work is in choosing what to expose and validating every input. This is the build . For what MCP is, its three primitives, and how it differs from an API, start with what is the Model Context Protocol — this page assumes that and goes straight to code. Prerequisites You need very little to get a server running locally: A language with an official SDK. Python and TypeScript are the most mature; the same protocol is also implemented for other languages. This guide uses the Python SDK (the secondary path most people search for), with notes on where the TypeScript SDK is equivalent. Python 3.10 or newer and uv (recommended) or pip to manage the environment. An MCP client to test against — Claude Desktop, or the MCP Inspector that ships with the SDK. You do not need cloud credentials to build or run the server itself. Conceptually a server exposes three things — tools (model-callable functions), resources (readable data), and prompts (reusable templates) . The steps below add them in that order. Exact SDK signatures evolve, so treat the snippets as the current shape and check the live docs before shipping. Which spec revision this builds against. The code here targets MCP revision 2025-11-25 — the revision the spec's versioning page still names as the current protocol version. Revision 2026-07-28 is published and reworks the wire format substantially. A server built against 2025-11-25 stays conformant today; what the new revision changes for a server author is set out below, so you can build now and plan the move. Step 1: scaffold the server Create a project, install the SDK, and write the smallest server that runs. With uv : uv init weather cd weather uv venv source .venv/bin/activate # Install t

2026-08-03 原文 →
AI 资讯

Why Documentation Is Architecture

Most of the engineers consider documentation as an after-thought; a README on a finished system written in the final 20 minutes before a PR gets merged. That's the wrong way to do this relationship. Documentation is not a description of architecture. It is part of the architecture, and marking it as separate is the cause of so many rotting systems, which still pass all tests. The compiler doesn't care, your team does It could be a consistent codebase and yet it be undocumented garbage from the point of view of anybody who didn't write it. Only one sort of correctness is enforced by the compiler (or interpreter): does this code perform the operation that the instructions say it performs. It doesn't weigh in on why a specific table contains a deleted_at column, versus a hard delete, or why a service tries 3 times with exponential back-off, versus 5 times with a fixed interval. Those decisions include constraints that are not apparent in the diff, regulatory, historical, or performance. If these are only in the mind of the programmer who wrote them, the actual architecture is partially undocumented, and these constraints will be breached as soon as someone else messes with the code when it is under a tight deadline. Architecture is not only the shape of your services and schemas, it's the set of decisions and constraints that shape stayed within. Undocumented constraints are like walls that we don't see, or know about. They are walked through without anyone knowing they exist, and one of the assumed conditions is broken at a time. Documentation as a design artifact, not a report Good documentation should be done prior to and/or in the midst of implementation, not after. When writing a design doc that explicitly states the problem, the options you considered, the one you selected, and the tradeoffs you made, you are actually doing real design work, you are making mistakes in your thinking process that would only become apparent during production. There have been more ti

2026-08-02 原文 →
AI 资讯

Why I created PyBotchi (v4.1.4)?

Hello Everyone, I'm the creator of PyBotchi, an intent-based AI Agent Orchestrator. In this post, I will discuss some key concepts why I created it. A little bit of background first. I'm a solutions architect with 10 years of experience as a software engineer. Most of my work are high throughput, high reliability, low cost and low latency services. This is while making it simple and readable to improve it's maintainabality. When I'm designing a system, I usually prioritize these concerns. You may assume this is my bias in relates to AI Agent building. I'm also Claude Certified Architect (Foundation) and I found that PyBotchi aligns almost identical to Anthropic's core agent recommendations. TL;DR: PyBotchi is an lightweight, async-first Python framework that uses nested Pydantic models and OOP inheritance to turn LLM intent detection into clean, deterministic business logic without the overhead of complex graph orchestration. Why I created PyBotchi? I really believed that traditional coding can already solved what client's need. The only limitations we have is how we read the input and how we show the output. In most cases in web services, your API use JSON, XML, etc with their respective specification/structure. Input Analogy Assume you have created a Books CRUD endpoints (FastAPI with Pydantic). Your create endpoint will have a define specifications for book creation to have a validation and avoid user errors. Most of the time you will also validates sessions and permissions which also included in the request. If you want your chat bot to support those, you just need add those endpoint as intent (tools). If your model tool selection are able to detect intents. You are more "close" to being deterministic. "Your services will have 50 endpoints or more. You will flood your tool selection call" In your frontend UI, you segregate panels/forms/inputs in their respective pages. You don't usually join multiple intent in a same page. Cluttered UI will make your UX confusin

2026-08-02 原文 →
AI 资讯

Microsoft Up 15%. Me? 100% Down.

hey there, so i wanted to share something with you. this is a bit personal but i have been watching the news this week and bruh... things are not going good. i am jobless right now, no other source of income, and day by day things are getting worse. and the worst part? AI is literally fuking every job in the software field. so when i saw this week's stock market drama, it hit me different. Microsoft popped. Meta tanked. Same AI boom. Two completely opposite reactions. and all i could think was... yeah, this is exactly my life right now. The Numbers, Bruh let me break it down real quick because this is wild: Microsoft jumped like 15% after beating expectations. Azure grew 43%. full year Azure revenue crossed $100 billion. insane. Meta dropped 8–9% after missing on guidance. their free cash flow collapsed 91% year-over-year to just $784 million. like... 91%?? gone. same AI boom. same crazy spending. and the market said "you're amazing" to one and "you're done" to the other. Why Microsoft Won Microsoft actually showed receipts. they didn't just talk about AI, they showed the money coming in. Azure is growing, Copilot is making real revenue, investors can literally see the line between billions spent and billions earned. lesson? Wall Street doesn't hate AI spending. it hates AI spending without proof. Why Meta Lost Meta's problem is that nobody can see where the money comes back. Zuckerberg talked about the "AI capacity dilemma" — how much compute to keep for yourself vs sell to others. but guidance missed, free cash flow went to hell, and the market was like... nah bro, i need answers. and honestly? i relate to that feeling more than i want to admit. putting everything into something and people still saying "not enough." The Bigger Picture this week is a preview of everything coming. companies are dumping hundreds of billions into data centers, chips, and models, all betting AI demand keeps exploding. the ones who can prove it pays off? they get rewarded. the ones who

2026-08-02 原文 →
AI 资讯

TypeScript Just Got 10x Faster by Not Being TypeScript

Table of Contents Introduction Putting the 10x Claim Into Perspective How Did We Get Here? This Was an Extensive Evaluation The Priority Was Compatibility Why Not Rust? Why Not C#? Why Go Fit the Existing Compiler A Port, Not a Simple Translation Where Does the Performance Come From? Native Execution Parallel Processing Memory Efficiency and Larger Projects The Benchmarks Memory Usage The JavaScript API Trade Off Is It Still TypeScript? The F1 Analogy Large Companies Helped Test TypeScript 7 Should You Upgrade? Final Thoughts Introduction At the end of March 2025, I published this article: Go-ing Beyond TypeScript: Microsoft Picks Go: How Will This Change the Landscape? Giorgi Kobaidze Giorgi Kobaidze Giorgi Kobaidze Follow Mar 31 '25 Go-ing Beyond TypeScript: Microsoft Picks Go: How Will This Change the Landscape? # microsoft # typescript # go # csharp 1 reaction 2 comments 12 min read At the time, Microsoft's decision to port the TypeScript compiler to Go sparked quite a bit of discussion and controversy. Many people questioned whether moving such a critical piece of the ecosystem away from TypeScript was the right choice. And boy, did Microsoft deliver what it promised: an order-of-magnitude performance improvement on some of the world's largest TypeScript codebases. The results are here, and the benchmarks speak for themselves. Putting the 10x Claim Into Perspective The phrase "10x faster" describes the scale of the improvement Microsoft has demonstrated. It does not guarantee that every codebase will become exactly ten times faster. The results depend on the size of the project, the work being performed, and the available hardware. Some projects might see a 5x improvement, while others could reach 8x, 10x, 12x, or potentially even more. No, this doesn't make every TypeScript developer a 10x developer , But it does mean that compiling a TypeScript project, loading it in an editor, and receiving diagnostics could become dramatically faster after moving to the nat

2026-08-02 原文 →
AI 资讯

The plumbing behind newsletter apps: intake addresses, email-to-Atom, and what eight of them really cost

If you subscribe to more newsletters than you read, which tool fixes it depends entirely on which problem you actually have. Most roundups skip that step and just rank apps. Disclosure up front: we make one of the eight tools below. It's the last entry, it's new, and it has no track record — its section says so plainly. The other seven are real options and for most people one of them is the better pick. Every price and behaviour here was checked against the vendor's own site on 2 August 2026 . Where a vendor doesn't publish a price, this says that instead of guessing. The two problems people both call "too many newsletters" They aren't the same problem, and the tools split cleanly along the seam. Clutter. Newsletters are burying your real email. You'd read them, you just don't want them sitting next to your bank and your on-call alerts. The fix is routing: move them somewhere else. Volume. Twenty-five arrive a week and you have time for three. Moving them changes nothing — now you have twenty-five unread items in a nicer app. The fix is either condensing the pile or deciding what's in it. Almost every tool below solves exactly one of these. Buying a clutter tool for a volume problem is the standard way to end up paying a subscription and still having the same unread count. The plumbing, since you're the one wiring it up Four mechanics show up across all eight: Dedicated intake addresses. Readwise Reader, Meco, Readless and Digest each hand you an address on their domain (Meco's look like you@mecoinbox.com ). You subscribe with it and their infrastructure receives the mail — the cleanest integration point available: no OAuth scope on your mailbox, no IMAP polling, no shared credentials. Mailbox connection. Meco will alternatively connect Gmail or Outlook and pull your existing subscriptions across, setting the selected ones to skip your inbox (reversible at any time, per Meco's FAQ). Much faster than re-subscribing to 25 newsletters by hand. The cost is a read scope

2026-08-02 原文 →
AI 资讯

One keystroke to a project: building a tmux session launcher with fzf

I hit Ctrl-F more than any other key combination on this machine. It runs a shell function called fts — "find tmux session," which is not a good name but it's four years too late to change it. I press it, a fuzzy finder opens listing every project directory I have, I type a few characters, and I'm sitting in a tmux session for that project with the panes already laid out. If the session already existed, I'm back in it exactly where I left off. If what I typed doesn't exist yet, it offers to create it. Somebody watched me do this over a screen share recently and asked what was going on. So: here's the whole thing, the four tools it's built on, and a breakdown of every part that isn't obvious. What you'll end up with: One keystroke from anywhere to any project Fuzzy search across every repo you own, with a live directory tree preview Type a name that doesn't exist → it offers to scaffold and place it Never accidentally start a second tmux session for a project you already have open The same window/pane layout in every project, every time The problem it solves Before this, starting work looked like: cd ~/repo/work/some-project-i-half-remember-the-name-of tmux new-session -s some-project # split some panes, badly, slightly differently each time Three or four commands, one of which needed me to remember a path. None of it hard. All of it friction at exactly the wrong moment — the moment you've decided to start something, which is the moment you're most likely to get distracted instead. I'd also collected tmux sessions named 0 , 1 , 2 and some-project-2 , because I kept starting new ones instead of attaching to the one already running. So the goal wasn't really speed. It was making the right thing the automatic thing. Prerequisites Four tools plus zsh. All four are worth having on their own, and three of them are things you'll reach for daily once installed. Tool Version I'm on What it does here tmux 3.6a The terminal multiplexer. Holds the sessions, windows and panes. fz

2026-08-02 原文 →