Categories
Mastering Development

Efficient neighbourhood search in numpy ndarray instead of nested conditional for loops

Although there are many instances of the question: "What is the numpy alternative to nested for loops", I was unable to fins a suitable answer for my case. Here it goes: I have a 3D numpy array with "0" background and other integers as foreground. I would like to find and store the foreground voxels […]

Categories
Mastering Development

How to make smooth transition in Three.js with shaders?

I have a basic Three.js app which just adds two textures to the plane. I pass them as uniforms to my shaders where I transform one to another when my mouse enters the plane. And my question is is there a way to add a transition to this process of changing one texture to another? […]

Categories
Mastering Development

when we reshape numpy array, how is the stride size inferred?

I have an 1×1024 1-d array (flattened image). To see the image, I want to reshape its size as 32×32. I can easily achieve this by doing x.reshape(-1,32) and it works as I intended. It doesn’t screw the image. It reads the 1d array with 32-width stride each time. Say this time, there are 4 […]

Categories
Mastering Development

Iteration on images with Pytorch: error due to CUDA memory issue with batch size 1

During training, the architecture generates three models and now encoder is used to encode images with iterations=16. After performing 6 iteration, i got an error. "CUDA out of memory". I have 4 gpus and i also implemented dataparallel class but it does not work Transformation while training train_transform = transforms.Compose([ #transforms.RandomCrop((32, 32)), transforms.ToPILImage(), transforms.Resize((512, 512)), […]

Categories
Artificial Intelligence (AI) Mastering Development

DDPG doesn’t converge for MountainCarContinuous-v0 gym environment

I am trying to implement Deep Deterministic policy gradient algorithm by referring to the paper Continuous Control using Deep Reinforcement Learning on the MountainCarContinuous-v0 gym environment. I am using 2 hidden Linear layers of size 32 for both the actor and the critic networks with ReLU activations and a Tanh activation for the output layer […]

Categories
Mastering Development

Export array of object in excel file (JavaScript)

I have array of objects in java like this : var video= [ ["name1",1,2,3], ["name2",4,54,44], ["name3",212,212,1213], ["name4",32,133,33] ]; i want to export it to excel file using javascript.

Categories
Mastering Development

Recursive CTE to SUM amount column using date column as terminating condition

I have a table containing loan data including the start date, loan term, and monthly payment. CREATE TABLE [dbo].[loan]( [id] [int] IDENTITY(1,1) NOT NULL, [Starting_Date] [date] NULL, [Loan_Term] [int] NULL, [Monthly_Payment] [decimal](19, 2) NULL ) ON [PRIMARY] GO Sample Data: INSERT INTO [dbo].[loan] ([Starting_Date] ,[Loan_Term] ,[Monthly_Payment]) VALUES (‘8/1/2020’, 52, 1), (‘6/2/2010’, 64, 2500), (‘9/11/2011’, 66, […]

Categories
Linux Mastering Development Ubuntu

Unable to boot Windows 10 after installing Ubuntu 16.04

Windows 10 is not present in the boot menu. I tried grub-update and other commands, but nothing worked. Windows exists in the "Host" Folder as well as most of the contents, but I’m unable to install that Windows. It shows an error during extraction. ============================== Boot Info Summary =============================== => No boot loader is installed […]

Categories
Mastering Development

stack in using the last version of threejs r118 , i have bad black output in web

look this , my code output as below i have this output by threejs script code code as below : <script> var camera, scene, renderer; var geometry, material, mesh; var texture , controls ; init(); function init() { scene = new THREE.Scene(); camera = new THREE.PerspectiveCamera( 50, window.innerWidth*0.65/window.innerHeight, 0.1, 1000 ); camera.position.z = 50; var […]

Categories
Mastering Development

Storing decimal number in plist

I want have some decimal numbers stored in plist and retrieve them on request. The plist: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>sessionLength</key> <integer>1800</integer> <key>name</key> <string>Sleeping</string> <key>generators</key> <array> <dict> <key>dynamic</key> <dict> <key>amplitude</key> <string>40,35,32,30,28,26,22,14,4</string> <key>beat</key> <string>3.8,3.3,3.0,3.0,2.8,2.6,2.4,2.0,2.0</string> <key>carrier</key> <string>1:3,1:5,1:6,1:5,1:6,1:5,1:6,1:4,1:3</string> <key>type</key> <integer>0</integer> <key>isoType</key> <integer>0</integer> <key>depth</key> <string>40,40,40,40,40,40,40,40,40</string> </dict> <key>static</key> <dict> <key>amplitude</key> <real>45</real> […]