Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
71 views

I have a Tensorflow dataset that contains tensors of rank 2. Each tensor was read from a file and has varying first dimension and constant second dimension. For example, the shapes of each item can be ...
Daniyar's user avatar
  • 11
1 vote
0 answers
147 views

I have a model that takes pairs of sequences. The sequences are of variable length. My model does this: embeds each item of both sequences sums embeddings of all items for each sequence calculates ...
Maxim Blumental's user avatar
1 vote
0 answers
218 views

my goal: Using keras, I want to add a (non-ragged) dimension to a ragged tensor: My initial ragged tensor has shape [batch size, (# time steps), # features]. I want a final ragged tensor with shape [...
Eric Zarahn's user avatar
0 votes
1 answer
224 views

I am asking a question very similar to that of TensorFlow broadcasting of RaggedTensor Basically, I am doing machine learning, and one data sample consists of a list of lists of coordinates, where ...
Aiden Yun's user avatar
1 vote
0 answers
57 views

The problem being solved is a binary classification using CNN. Here I have images of different size. I am scaled down the images to 20% and normalizing them to the range (0,1) and obviously they still ...
Chetan's user avatar
  • 11
1 vote
1 answer
632 views

I have an input Tensorflow ragged tensor structured like this [batch num_images width height channels] and I need to iterate over the dimension num_images to extract some features relevant for ...
Alberto's user avatar
  • 467
2 votes
1 answer
363 views

I need a dataset structured to handle a variable number of input images (a set of images) to regress against an integer target variable. The code I am using to source the images is like this: import ...
Alberto's user avatar
  • 467
1 vote
1 answer
299 views

I would like learn if there is a decent and tensorflownic way to do follow conversion. Basically each string(row) as several words, and each word has a suffix like "%1", and goal is to strip ...
user1269298's user avatar
0 votes
1 answer
274 views

I'd creating a Pandas DataFrame in which each particular (index, column) location can be a numpy ndarray of arbitrary shape, or even a simple number. This works: import numpy as np, pandas as pd x = ...
Basj's user avatar
  • 47.6k
0 votes
1 answer
321 views

I need to concat two ragged tensors keeping the last dimension with a fixed size 2. Checking model.output_shape I get the desired (None, None, 2). But when I call the model, I get (batch_size, None, ...
yolisses's user avatar
  • 156
2 votes
0 answers
351 views

I am trying to create a model with two inputs. The model is very simple containing only one lstm layer for each input. The problem is that I want to provide lists of different length as inputs. For ...
psitronic's user avatar
1 vote
0 answers
478 views

I have a tf.data.dataset with 2 and 3 dimensional ragged tensors: [ [1,2,3,4], [5,6,7,8], ... ] and [ [[1,2,3], [4,5,6] ], [[7,8,9], [10,11,12], ... ] ] ...
GBPU's user avatar
  • 684
2 votes
0 answers
417 views

I am trying to pass a 3D RaggedTensor of shape (batch_size=None, 1, 136) to a batch normalization layer, but am receiving the error in the title. I assume because RaggedTensors can very in dimensions, ...
GBPU's user avatar
  • 684
1 vote
1 answer
804 views

I have a tensor slice dataset made from two ragged tensors. tensor_a is like: <tf.RaggedTensor [[3, 3, 5], [3, 3, 14, 4, 17, 20], [3, 14, 22, 17]]> tensor_b is like: <tf.RaggedTensor [[-1, 1, ...
pieckannie's user avatar
0 votes
1 answer
837 views

How can I save a ragged tensor as a file on my disk and then reuse it in calculations opening it from the disk? Tensor consists of a nested array of numbers with 4 signs after the point. (I'm working ...
Vvictory's user avatar
1 vote
1 answer
589 views

I have a raggedTensor of row_lens going from 1 to up to 10k. I would like to select elements randomly from it with an upper limit on the number per row in a scalable way. Like in this example: vect = [...
Nodiz's user avatar
  • 413
1 vote
1 answer
4k views

I created a random function with the line below x = torch.randn(4, 3) and used the transpose function as shown here torch.transpose(x, 0, 1) I got the error line below. Who can assist with a ...
Lamosh's user avatar
  • 41
1 vote
1 answer
810 views

I'm getting an odd error when trying to use tf.ragged.stack. I'm trying to stack two tensors t1, t2, however they have different rank. t2 is 1 rank less than t1. Therefore I used tf.expand_dims to ...
ablanch5's user avatar
  • 338
0 votes
2 answers
705 views

I have an array output and a id subject_ids. output = [[[1, 2, 3]], [[4, 5, 6]], [[7, 8, 9]]] subject_ids = [[0, 1], [1, 2], [0, 2]] The numbers in ID represent the start and end positions ...
wwwxinyu's user avatar
1 vote
1 answer
485 views

I'm using tensorflow v2.7.0 and trying to create a ML model using ragged tensor. The issue is that tf.linalg.diag, tf.matmul and tf.linalg.det are not working with ragged tensor. I've found a ...
Romain Warlop's user avatar
1 vote
1 answer
665 views

I am trying to use tensorflow's tf.map_fn to map a ragged tensor but I am getting an error that I can't fix. Here is some minimal code that demonstrates the error: import tensorflow as tf X = tf....
ablanch5's user avatar
  • 338
1 vote
0 answers
201 views

g=tf.random.normal([1000,627,16,1]) ind1=tf.constant(np.random.randint(100,size=(251,128,128,3))) ind2=tf.constant(np.random.randint(100,size=(150,128,128,3))) ind3=tf.constant(np.random.randint(100,...
wangwei's user avatar
  • 49
0 votes
0 answers
152 views

I am looking at a problem that takes in an argument of a 3D STL file -> Shape and (rmin -> Minimum Radius) and fits in a maximum number of spheres inside the shape. The function should spit out ...
Paritosh Kulkarni's user avatar
2 votes
1 answer
821 views

This Tensorflow doc gives this example of using tf.map_fn on ragged tensors which works for Tensorflow 2.4.1 and above: digits = tf.ragged.constant([[3, 1, 4, 1], [], [5, 9, 2], [6], []]) print(tf....
Lars Ericson's user avatar
  • 2,134
3 votes
1 answer
2k views

I am training a deep learning model on stacks of images with variable dimensions. (Shape = [Batch, None, 256, 256, 1]), where None can be variable. I use tf.RaggedTensor.merge_dimsions(0,1) to ...
Wayne's user avatar
  • 31
0 votes
0 answers
190 views

x is a list of 2D-arrays, and each 2D-array is a series of 6-tuple. I want to transform x into a ragged tensor. I try xrag = tf.ragged.constant(x) and get xrag with shape = (895, None, None), ...
thanksarose's user avatar
1 vote
0 answers
272 views

I am trying to train a TF model that will look at a customer's cart values regarding food categories and predict what food category the customer will be interested in next. There are only 5 types of ...
Sayan Banerjee's user avatar
0 votes
0 answers
116 views

I want to convert a 1-D tensor to 2-D shape in Tensorflow 2, with the number of elements in each row is given. I found a solution using the RaggedTensor like this numbers = tf.constant([1,3,2,5,4]) c0 ...
Xun Chen's user avatar
1 vote
0 answers
260 views

I have a ragged tensor seq (num_sentences, num_words, word_dim). If I want to add a new axis (dimension) at the end with a slice seq[..., tf.newaxis], it fails with the error below. tf.expand_dims(seq,...
Adam's user avatar
  • 1,827
3 votes
0 answers
606 views

I am trying to train a neural network using TensorFlow that takes as input (tf.keras.layers.Input) a RaggedTensor. It works fine on CPU and GPU but I am really strugling to make it work on TPU. I ...
Vince.Bdn's user avatar
  • 1,175
1 vote
1 answer
1k views

I have a 4D RaggedTensor of shape (batch_size, None, None, 100), I want to create from this a tensor of shape (batch_size, None, 100). So basically merging 1st and 2nd dimensions, but not including ...
foobar's user avatar
  • 4,029
1 vote
1 answer
1k views

I have a 2D RaggedTensor consisting of indices I want from each row of a full tensor, e.g.: [ [0,4], [1,2,3], [5] ] into [ [200, 305, 400, 20, 20, 105], [200, 315, 401, 20, 20, ...
AAC's user avatar
  • 591
0 votes
2 answers
1k views

like this: ''' a = [1.0, 2.0, 3.0] b = [[a, a, a, a], [a, a, a], [a, a, a, a, a, a, a], [a, a]] c = tf.ragged.constant(b, dtype=tf.float32) ''' I got a tensor with shape : [4, None, None], but i ...
ke jiang's user avatar
0 votes
1 answer
815 views

Having a DF of 50,000 users each having different count of rows: id feature_1 ... feature10 feature11 0 1587712104294-4384584 -0.661835 ... ...
Shlomi Schwartz's user avatar
8 votes
2 answers
2k views

I have a ragged tensor of dimensions [BATCH_SIZE, TIME_STEPS, EMBEDDING_DIM]. I want to augment the last axis with data from another tensor of shape [BATCH_SIZE, AUG_DIM]. Each time step of a given ...
JuliettVictor's user avatar
3 votes
2 answers
4k views

I've created a TensorFlow model that uses RaggedTensors. Model works fine and when calling model.predict and I get the expected results. input = tf.ragged.constant([[[-0.9984272718429565, -0....
Shlomi Schwartz's user avatar