Questions tagged [zero-padding]

The practice of padding a number (or string) with zeros in order to match an expected number of characters or bytes.

The practice of padding a number (or string) with zeros in order to match an expected number of characters or bytes.

For example, if the expected length of a string is 6, the number '123' could be zero padded as '000123' in order to meet this expected length.

111 questions
1
vote
1 answer

Zero-padding a string to a finite length

I would like to add a zero padding to a string to make the string a specific final length. In my specific case I want the string to be of length 6 at the end and be padded with 0's before. int val = 5; int val2 = 12; char* padded_val =…
Max Michel
  • 575
  • 5
  • 20
1
vote
0 answers

Trouble with zero-padding inputs for Steered Convolution Layer

I'm using Tensorflow's new graphics library to apply a steered convolution to a series of meshes. In many cases, you will have a series of meshes that are not the same size and you must zero-pad the smaller ones. According to the documentation,…
1
vote
1 answer

Pad elements in ndarray using unique padding for each element

I am quite new to python and have read lots of SO questions on this topic however none of them answers my needs. I end up with an ndarray: [[1, 2, 3] [4, 5, 6]] Now I want to pad each element (e.g. [1, 2, 3]) with a tailored padding just for that…
Melron
  • 459
  • 4
  • 14
1
vote
2 answers

Tensor-flow how to use padding and masking layer in case of MLPs?

I want to use MLPs to solve regression problem. I have inputs with variable length to fix this I want to use Zero-padding with masking layer. I read the inputs from csv file using pandas library. Here is how my data look like. I know only how to…
DINA TAKLIT
  • 7,074
  • 10
  • 69
  • 74
1
vote
2 answers

Numpy pad zeroes of given size

I have read most related questions here, but I cannot seem to figure out how to use np.pad in this case. Maybe it is not meant for this particular problem. Let's say I have a list of Numpy arrays. Every array is the same length, e.g. 2. The list…
Bram Vanroy
  • 27,032
  • 24
  • 137
  • 239
1
vote
3 answers

JS - How can I generate a long random number?

I know that I need to use Math.random() for making random numbers, but today I tried to make a random number between 1 and 9999...(9 repeated 19 times) and my output always ends in 3-5 zeroes. How can I generate more detailed random numbers? What…
DexieTheSheep
  • 439
  • 1
  • 6
  • 16
1
vote
1 answer

The fundametal method to convert a hex to base64 in python3

I want to convert a given hex into base64 (in python without using any libraries). As I learned from other stackoverflow answers, we can either group 3 hex (12 bits i.e. 4 bits each) to get 2 base64 values (12 bits i.e. 6 bits each). And also we can…
RJ_SU
  • 31
  • 9
1
vote
1 answer

Should right padding an HMAC SHA256 secret key with \0 return the same hash?

When using the JavaX HMAC/SHA256 hashing libraries, if I right pad my secret key with non-zero bytes, the hash for the same message is different; as expected. hmacSHA256digest( "secret".getBytes("UTF-8"), msg) =…
Roberto Olivares
  • 1,053
  • 1
  • 11
  • 19
1
vote
1 answer

What would happen if a system executes a part of the file that is zero-padded?

I've seen in some posts/videos/files that they are zero-padded to look bigger than they are, or match "same file size" criteria some file system utilities have for moving files, mostly they are either prank programs, or malware. But I often…
Shadowjonathan
  • 253
  • 2
  • 11
1
vote
3 answers

how to put specific number of characters in front of a string in pl/sql?

I want to fix a string to length of 20 characters after the operation. For example, if my string is 1455 then new string should be 00000000000000001455 (20 characters) with 16 0s in front. Or if my string is 12345678 then new string should be…
cihadakt
  • 3,054
  • 11
  • 37
  • 59
0
votes
0 answers

Transformer's zero-padding became non-zero after passing normalization layers, making unnecessary weight updates

Since NLP tasks have variable-length data, we need to add paddings to make the same size with other inputs in a mini-batch. However, paddings became non-zero after passing normalization layers. This makes gradients for each padding, which makes…
0
votes
0 answers

Tensorflow lambda layer function defintion

as part of my work I am currently studying the code provided here : https://github.com/Era-Dorta/tf_mvg/blob/master/examples/autoencoder_mvg_chol_filters.py I have a question about line 60 of this script, in the function decode_covar()…
0
votes
1 answer

Roll and pad in Numpy

Is there a built-in Numpy function to shift (roll + pad) an 1D array? Something like this: import numpy as np def roll_pad(a, t): b = np.roll(a, t) if t >= 0: b[:t] = 0 else: b[t:] = 0 return b z = np.array([1, 2,…
Basj
  • 41,386
  • 99
  • 383
  • 673
0
votes
2 answers

Pad a string in DolphinDB

I wonder if there are any alternatives to the Python rjust or zfill in DolphinDB. I want to add zeros(0) on the specified side of a string until it reaches the specified length. How could I do?
Shena
  • 341
  • 1
  • 5
0
votes
1 answer

How to check if all values in the list are the same length? And if not how to add extra digits to equalise those values?

I'm doing a little coding in Python, and I came up to the issue that some of my values and not the same length. Desired length is 15 characters for example: string = ['110000111100111', '100100110011011', '001101100110', '01011010001110',…