Skip to main content

Posts

The size of tensor a (100) must match the size of tensor b (64) at non-singleton dimension 2"

I am trying to implement a simple linear network. The input tensor size is (B,3,64,64) My network is defined like this. tensorSize = x.size() input = tensorSize[0] * tensorSize[1] * tensorSize[2] self.linear_one = torch.nn.Linear(64, input) self.linear_two = torch.nn.Linear(input, 32) self.linear_output = torch.nn.Linear(32, 6) self.layer_in = self.linear_one(x) self.layer_in_two = self.linear_two(self.layer_in) self.layer_out = self.linear_output(self.layer_in_two) My output is size (B,3,64,6) but it needs to be (B,6) Why is my network not outputting the correct results? source https://stackoverflow.com/questions/76984392/the-size-of-tensor-a-100-must-match-the-size-of-tensor-b-64-at-non-singleton

Is there a way to create multiple separate GUIs in p5js without initialising too many global variables?

Context: I'm currently using p5gui and quicksettings to create GUIs, but I've been creating them by initialising global variables first and then creating them using "addGlobals()". With this method, I was able to create separate GUI panels on the same canvas but I'd rather minimize the use of global variables if possible. I have considered wrapping the GUI variables into an object like let params = {... } gui.addObject(params) but it turns out that doing this combines everything together and makes up one big GUI panel. Is there a way to create multiple separate GUIs with as few global variables as possible? Like a constructor of some sort. Via Active questions tagged javascript - Stack Overflow https://ift.tt/1Ds6lFM

How can I pass the inputs array of student answers to the controller?

I can't pass the inputs array of student answers to the controller with JavaScript. The big problem is if I use a form How can I receive the request values? Is it possible to send the student's answers in one array through the form? The Blade page is : @extends('layout.master') @section('css') @section('title','Teachers') <link href="../assets/js/DataTables/datatables.min.css" rel="stylesheet"> @endsection @section('content') <div class="container-xxl flex-grow-1 container-p-y"> <h4 class="fw-bold py-3 mb-4"><span class="text-muted fw-light"> /</span> ورقة إمتحان الطالب </h4> <hr class="my-1"/> @if($errors->any()) <div class="alert alert-danger"> <ul> @foreach($errors->all() as $error)

Retrieve numeric property name from object [duplicate]

I received the below json result and am trying to get the 2048 value. below is the JSON result. { "0": "https://media.elomilingerie.com/medias/110x154-pdp-thumb-ES801502-BLK-primary-Elomi-Swim-Tropical-Falls-Black-Underwire-Plunge-Bikini-Top.jpg?context=bWFzdGVyfHByb2R1Y3RJbWFnZXN8ODEzNXxpbWFnZS9qcGVnfGFHWmhMMmhtWmk4NU56STBOek14TlRVMU9EY3dMekV4TUhneE5UUmZjR1J3WDNSb2RXMWlYMFZUT0RBeE5UQXlYMEpNUzE5d2NtbHRZWEo1WDBWc2IyMXBMVk4zYVcwdFZISnZjR2xqWVd3dFJtRnNiSE10UW14aFkyc3RWVzVrWlhKM2FYSmxMVkJzZFc1blpTMUNhV3RwYm1rdFZHOXdMbXB3Wnd8MjZkNTRlMWY1YWM4OWY2MTNkNDYxM2Q5NDdkZDk4NjYwY2M5NWYzN2ZmZDYzNmI3MTc5NTlkMzM4YTg5NmI5Yg", "640": "https://media.elomilingerie.com/medias/480x672-pdp-mobile-ES801502-BLK-primary-Elomi-Swim-Tropical-Falls-Black-Underwire-Plunge-Bikini-Top.jpg?context=bWFzdGVyfHByb2R1Y3RJbWFnZXN8ODMxMDZ8aW1hZ2UvanBlZ3xhRGMyTDJoaE15ODVOekkwTnpNMU5ESXlORGswTHpRNE1IZzJOekpmY0dSd1gyMXZZbWxzWlY5RlV6Z3dNVFV3TWw5Q1RFdGZjSEpwYldGeWVWOUZiRzl0YVMxVGQybHRMVlJ5Yj

d3 circle packing with a gap at the center

I am using the d3.js pack() method to pack the circles. But I want to leave an empty circle in the center like a gap, and then pack the circles around it. I tried using forceSimulation without luck. I want to achieve something like shown in the picture using pack(). Via Active questions tagged javascript - Stack Overflow https://ift.tt/GMLdkKE

How can I get started parsing binary files in JavaScript?

I have some binary files I'd like to be able to parse within the browser. I have found some python code that (I think) does exactly what I need but I don't understand python enough to interpret what I'm seeing. I have some sample files on my own code repository , and below is my attempt at parsing these files. You can drag files into the snippet window to parse that file const elBody = document.body; const dragClass = "drag-over"; const fReader = new FileReader(); fReader.onload = function (e) { const data = e.target.result; processFile(data); }; elBody.addEventListener("dragover", (dragEvent) => { dragEvent.preventDefault(); if (!elBody.classList.contains(dragClass)) { elBody.classList.add(dragClass); } }); elBody.addEventListener("dragleave", () => { elBody.classList.remove(dragClass); }); elBody.addEventListener("drop", (dropEvent) => { dropEvent.preventDefault(); elBody.classList.remove(drag

What is wrong with my code,it is not working properly

this is the line of code i am using to show the blogdata wrt email but it is showing cannot GET /myblog app.get("/myblog/:e_mail", async (req, res) => { const requestedEmail = req.params.e_mail; try { const user = await User.findOne({ email: requestedEmail }); if (!user) { throw new Error("User not found"); } if (!user.selfBlog) { throw new Error("User does not have a self-blog post"); } const post = user.selfBlog; res.render("myblog", { title: post.title, content: post.content }); } catch (error) { console.error("Error fetching post:", error); res.status(404).render("error", { errorMessage: "Post not found!" }); } }); i tried to get the data in my db but got the error specified and it is my first time writing here so sorry for any mitake and as english is not my first language so sorry for any error in my english Thank you Via Active