weightofsize[64,3,7,7],expectedinput[1,4,512,1024]tohave3channels,butgot4channels
For the record only,Please skip. After the blogger’s article,The blogger opened a new picture,After feeding the model-this problem occurred again:weight of size [ 64, 3, 7, 7], expected input[1, 4, 512, 1024] to have 3 channels, but got 4 channels instead That is, the original three-channel picture, ; After reading, it becomes four channels. Solution Add .convert('RGB'),Yes Image.open functionCaused That’s it. Thanks to the big blogger for the article :Portal
How many implementation codes that are different from each other and do not have repeated numbers can be composed by Java1,2,3,4
Question: There are 1, 2, 3, and 4 numbers. How many different three-digit numbers can be formed without repeated numbers? How many are they? Program analysis: The numbers that can be filled in the hundreds, tens, and ones places are all 1, 2, 3, and 4. After composing all the permutations, remove the permutations that do not meet the conditions. Programming: public class Wanshu { public static void main(String[] args) { int i=0; int j=0; int k=0; int t=0; for(i=1;i<=4;i++) for(j=1;j<=4;j++) for(k=1;k<=4;k++) if(i!=j && j!=k && i!=k) {t+=1; System.out.println(i*100+j*10+k); } System.out.println (t); } }
JavaScript variable:vara=(3,4,7);
It’s called the comma operator. By wrapping the right-hand expression in parentheses, we create a group and evaluate each of its operands and return The last value. From MDN The comma operator evaluates each of its operands (from left to right) and returns the value of the last operand. The comma operator is useful when you want to write a minifier and need to shrink the code. For example, print = () => console.log(‘add’) add_proc = (a,b) => a + b function add(a, b){ if(a && b){ print(); return add_proc(a,b) } else { return 0 } } console.log(add(1,2)); You can use the comma operator to reduce it as follows: print = () => console.log(‘add’) add_proc = (a,b) => a + b add = (a, b)=> a && b ?(print(),add_proc(a, b)):0 console.log(add(1,2)); 1> Mihai Alexan..: It is called the comma operator. Expressed by the right hand Formula wrapped in parentheses, we create a group, evaluate each of its operands and return the last value. From MDN The comma operator evaluates each of its operands (from left to right) and returns the value of the last operand. The comma operator is useful when you want to write a minifier and need to…
Write java to merge two arrays, {1,2,3,4,5}{4,5,6,7,8}
Java writes two arrays to merge, {1,2,3,4,5} {4,5,6,7,8} It is divided into two steps: 1. Connect the two arrays.2. Clear duplicate elements.import java.util.Arrays; public class Combine{ public static void main(String[] args){ int a[]={1,2,3,4,5}; int b[]={ 4,5,6,7,8}; int temp[]=new int[a.length+b.length]; //Connect two arrays for(int i=0;ijava writes to merge two arrays, {1 ,2,3,4,5} {4,5,6,7,8} < How to combine java string arrays into one array in java? h3> java
How to get things from JavaString array (such as String[]A={1,2,3,4})
How to get the things in Java String array (such as String[] A = {1,2,3,4}) Java array is a class often used in Java programming. The following is How to use Java array String: 1. The syntax of Java array: String[array subscript], the subscript of Java array starts from 0. 2. To obtain all elements in the array, array traversal will be used, usually using a for loop. 3. Output prints all elements in the array, separated by “,”. 4. You can use it to define which string the three strings k, p, f and t are. 5. You can use the binarySearch(Object[] a, Object key) method in the Arrays class to find whether a certain value exists. How to retrieve data from an array in java 1. Method: public final synchronized void setsize(int newsize); This method is used to define the size of the vector. If the vector object is present If the number of members exceeds the value of newsize, the excess elements will be lost. 2. An object of the Enumeration class is defined in the program. Enumeration is an interface class in java.util. Enumeration encapsulates methods for enumerating data collections. Enumeration provides the method hasMoreElement() to…
Write java1,1,2,4,7,13,24,44 algorithm in java
//Use java to write java1,1,2,4,7,13,24,44 algorithm —- Baidu knowsimport java.util.ArrayList;import java.util.List;import java.util.Scanner;public class Result {//The first three numbersprivate int a = 1, b = 1, c = 2;private List list = null;//Construction methodResult() {list = new ArrayList();list.add(a);list.add(b);list.add(c);}//Return resultpublic int getResult(int index) {if(index >= 0 && index <=3) {return list.get(index);} else if(index < 0) {return – 1;}return calc(index).get(index);}//Calculate the sum and add it to the collectionprivate List calc(int index) {for(int i=3; i<=index; i++) {//Each number is equal to the sum of the first threeint temp = list.get(i-1) + list. get(i-2) + list.get(i-3);list.add(temp);}return list;}public static void main (String[] args) {System.out.println(“Please enter the location:”);int index = new Scanner(System.in).nextInt();System.out.println (The result of the “th” + index + ” position is: ” + new Result().getResult(index – 1));}}This type of article is only For record purposes. This article comes from the “IT Traveler” blog, please be sure to keep this source http://fylxopensource.blog.51cto.com/1328715/1543520
12345 forms three non-repeating numbers java_use 1,2,3,4,5 to form 5 non-repeating digits, 4 cannot be in the third place, 3 and 5 cannot be connected (the simplest way)…
package com.wzs; //Increase the difficulty of the first question ,Use five numbers: 1, 2, 3, 4, 5,Write a main in java Function ,prints out all different permutations, //Such as :51234, 12345, etc.,requires:”4″ cannot be in the third position ,”3″ and “5” cannot be connected. public class Test3 { public static void main(String[] args) { int number = 0; int count = 0; String numberStr; for (int a = 1; a <= 5; a++) { for (int b = 1; b <= 5; b++) { for (int c = 1; c <= 5; c++ ) { for (int d = 1; d <= 5; d++) { for (int e = 1; e <= 5; e++) { // Print out all non-repeating numbers if (a != b && a != c && a != d && a != e && b != c && b != d && b != e && c != d && c != e && d != e) { number = a * 10000 + b * 1000 + c * 100 + d * 10 + e; numberStr = String.valueOf(number); //4 cannot be the third digit, “3” and “5” cannot be connected if (numberStr.indexOf(“4”) != 2…
In javascript, why [1,2]+[3,4] is not equal to [1,2,3,4]?
Someone asked on stackoverflow: arrays – Why does [1,2] + [3,4] = “1,23,4” in Javascript? Question I want to append an array to the back of another array, so I wrote the following code in firebug: [1,2] + [3,4] However, unexpectedly, it output: “1,23,4” What I expected was not output: [1,2,3,4] What is going on? ? Why is [1,2] + [3,4] not equal [1,2,3,4]? Answer Javascript’s + operator has two goals: Add two numbers Add; Concatenate the two strings. The example does not define the behavior of the + operator on arrays, so Javascript first converts the array into a string, and then perform + operations on the string. If you want to connect two arrays, you can use the concat method of the array: [1, 2].concat([3, 4 ]) // [1, 2, 3, 4] Overview of the + operator in Javascript Javascript has 6 built-in data examples: ( Translation note: Judging from the connections given, the original author’s meaning should be the data type of the original type system. Javascript actually has two types of systems. The first type system uses typeof to identify it, called the primitive (primitive) paradigm system, and the second set of paradigm systems is based…
PHP array, how does $a={0,1,2,3} become $a={1,2,3,4]
PHP array, how does $a = {0,1,2,3} become $a = {1,2,3,4]PHP array, how does $a = {0,1,2,3} change becomes $a = {1,2,3,4]. It is the dimension of the multi-dimensional array, and then adds 1 to the dimension and outputs it as the sequence number of the table, 1, 2, 3, 4——Solution—- —————- $a = array(0, 1, 2, 3); $b = range(1, count($a)); $c = array_combine($b, $a); print_r($c); Array ( [1] => 0 [2] => 1 [3] => 2 [4] => 3 ) ——Solution——————– $arr = array(0,1,2,3); $temp = array(); foreach($arr as $k=>$v){ $k++; $temp[] = $k; } print_r($temp); The moderator’s is prettier! ——Solution—— —————The moderator’s idea is beautiful, and here is another idea. <?php $a = array(0,1,2,3); array_unshift($a, 0); // Insert a new element at the beginning of the array to increase the key by 1 unset($a[0]); // Delete the newly added elements at the beginning, but the key remains unchanged print_r($a); // Output ?>
Implementation of session in php3,4
Implementation of session in php3 and 4 There is no such thing as session in php3, but we need it, what should we do? Don’t worry, there are many people who have done this for you, the most famous of which is phplib. You can download it abroad or you can download it from most PHP sites in China. The first thing we need to do is get phplib and php3 together to make it work. In order to achieve this function, we need to install phplib first. Follow me, it’s very easy (the following method is passed on win2000+php3.0.16+apache1.3.12+phplib7.2c+mysql3.23.21 for win32) The most basic functions of phplib include user authentication , Session management, permissions and database abstraction. How to use phplib to implement the session function? 1. First, unzip phplib. There is a directory called “php” in it. Copy this directory to the installation directory of apache. The following takes the author’s machine as an example: My apache is installed in the d:apache directory. I copied the above “php” directory to d:apache, and combined the files and directories in the pages directory under phplib. Copy it to d:apachehtdocs, making sure not to include the directory itself. The phplib class…