Given a list len_list
of the number of ones for the vectors, e.g.:
[1]
[3]
[2]
[1]
where the shape of len_list
now is (4, 1)
And given the number of columns of the vector, e.g. vec_dim = 5
.
I'd like to generate a tensor with the first of few columns as 1 and the rest as 0.
For example, a matrix with shape of (4, 5)
as:
[1 0 0 0 0]
[1 1 1 0 0]
[1 1 0 0 0]
[1 0 0 0 0]
How to do so?
I understand I could generate this matrix with iteration.
But in my case, the batch size is not set, i.e. the shape for len_list
is (None, 1)
, I have to feed the placeholder with batch size to fulfill this function. Thus, how could I generate a tensor with shape (None, vec_dim)
???
Can't import @google/pubsub and other @google npm module in Node.js 13.6
Best way to constantly show whats on node queue (Using Bottleneck)
Axios in a Node.js container on Kubernetes is returning “ECONNREFUSED 127.0.0.1:30561”?
Property 'map' does not exist on type 'Observable<Object>'.ts(2339)
This code copies the first sheet of an excel workbook that already has formulas into a new bookFor some reason, when you move the sheet, the formulas still reference the old book (in the example below-- Book1)
Can't figure out why this is returning as bound method HtmlMixintext_content, trying to create a web-scraper and display the data in a dataframe
Well, I am trying the mrjob library and the code I wrote is not working properlyI looked at it and it seems fine from the little that I know about MapReduce library