All Questions
Tagged with variable-length-array python
14 questions
-1
votes
1
answer
114
views
In Python why does the variable specified inside the loop has length 1 whereas the other outside the loop has its original length?
As declaring a variable1 inside for loop I have assigned some string to it>>>whereas given another variable2 .....when provided with the output it shows variable1 len is 1 and variable2 has 8 ...
0
votes
0
answers
100
views
Working with variable dimension tensors in tensorflow
I want to build a tensor placeholder, features with dimension, say (10, a, a). Such that features[i, :, :] can be an arbitrary square tensor. As an instance, features[0. :, :] may be of dimension 5*5, ...
-1
votes
3
answers
386
views
Update list using dictionary when values are lists of different lengths
*** UPDATE ****
The additional letter "A" was a problem. I'm rephrasing this here. Perhaps clearer?
I have to replace values in a list using a dictionary which has lists of variable lengths as its ...
1
vote
2
answers
9k
views
Create List with variable length in Python
testList= []
testList[12]= 31
testList[23]= 1337
Error: IndexError: list assignment index out of range
Basically I have unique Integers and I want to use the lists for a hash function h(x)= x (...
1
vote
3
answers
2k
views
How to make padding to max sequence lengths in batch with tensorflow dataset api?
I have for example
123
1234
12345
1234556
1234567890
It is easy to make global padding like this
0000000123
0000001234
0000012345
0001234556
1234567890
But I wanna padding in every generated by ...
0
votes
3
answers
1k
views
Number of Variables in an array
I have a code;
x = np.linspace(0, 12, 200, False, True, None)
when I print x, I get;
(array([ 0. , 0.06, 0.12, 0.18, 0.24, 0.3 , 0.36, 0.42, 0.48,
0.54, 0.6 , 0.66, 0.72, 0.78,...
1
vote
0
answers
868
views
Keras variable length input for regression
Everyone!
I am trying to develop a neural network using Keras and TensorFlow, which should be able to take variable length arrays as input and give either some single value (see the toy example below)...
0
votes
2
answers
53
views
Variable length string duplication in Python
The following short python script:
var1 = '7f0000000000000000000000000000000000000000000000000000000000000002'
var2 = '01'
output = 'evm --code ' + var1 + var1 + var2 + ' run'
print(output)
Is ...
2
votes
3
answers
14k
views
How to find the position of an item of a list in python?
I have two lists. The first list has a specific length and the second list has unstable length. I want to assign the items from two lists.
I use colour_index = sel_pos%(len(colours)). The sel_pos is ...
7
votes
4
answers
7k
views
Working with variable-length text in Tensorflow
I am building a Tensorflow model to perform inference on text phrases.
For sake of simplicity, assume I need a classifier with fixed number of output classes but a variable-length text in input. In ...
32
votes
8
answers
22k
views
Convert Python sequence to NumPy array, filling missing values
The implicit conversion of a Python sequence of variable-length lists into a NumPy array cause the array to be of type object.
v = [[1], [1, 2]]
np.array(v)
>>> array([[1], [1, 2]], dtype=...
-1
votes
3
answers
4k
views
If len Statement
I type in seven digits to be able to work out a gtin-8 product code. But if I type in more than seven digits, the if len statement is meant to recognise that I have typed in more than seven digits, ...
0
votes
0
answers
52
views
Python Code for plot. Receiving a message that I have 1 less Y value
from scitools.std import *
t = []
v = []
infile = open('running.txt', 'r')
for line in infile:
tnext, vnext = line.strip().split(',')
t.append(float(tnext))
v.append(float(vnext))
infile....
2
votes
2
answers
1k
views
Return variable length array in Numpy C-extension?
I have made some Numpy C-extensions before with great help from this site, but as far as I can see the returned parameters are all fixed length.
Is there any way to have a Numpy C-extension return a ...