Questions tagged [ragged]

A ragged array (or jagged array) is an array of arrays. The elements of a ragged array can be of different dimensions and sizes.

https://en.wikipedia.org/wiki/Jagged_array

78 questions
2
votes
1 answer

How to create ragged tensors with tensorflow.js

I can't seem to figure out how to create a ragged tensor with tensorflow.js. I also can't find anything in the api docs. I am working on making a simple cat vs dog AI and have images that are different sizes. I am using fs.readFileSync to get a…
MilesZew
  • 667
  • 1
  • 8
  • 21
2
votes
1 answer

Is it possible to stack a list of ragged arrays (where each array in the list is of size 1 row and n columns)?

I have a list of arrays. [array([ 2., 4., 6., 8., 10., 12., 14., 16., 18., 20., 22., 24., 26., 28., 30., 32., 34., 36., 38., 40., 42., 44., 46., 48., 50., 52., 54., 56.,…
user7345804
2
votes
3 answers

Importing first three and last three fields from CSV with variable number of fields

I've got a data set in csv. Unfortunately each line has different amount of "," commas. I am interested in importing only first 3 and last 3 variables from the file in R. in example: > line: "A","B","C","D",...,"X",Y","Z" I want to achieve the…
Meyk
  • 96
  • 10
2
votes
1 answer

Removing a String from a ragged 2D String array and shortening the array in the process

My professor gave out a review question for our midterm this week that I'm confused on: Write a method that is given a two-dimensional (ragged) array of String objects and returns a two-dimensional (ragged) array of String objects where all…
derpt34
  • 39
  • 5
1
vote
3 answers

Pad the last dimension of a tensor with different lengths to a specific length

I have a similar question, this one TensorFlow - Pad unknown size tensor to a specific size?. My question is more difficult though, and I didn't find any solutions can solve my question. My question is that what if the given unknown tensor have…
Francis
  • 189
  • 1
  • 11
1
vote
2 answers

Tensorflow gather, concatenate and then pad operation?

I have a 2D tensor in TensorFlow 2 (python). How can I pick-out and concatenate rows based on a ragged array of row indices and then pad shorter rows with zeros so that all rows end up with the same length? Here is an example of what I have: data =…
Morten Grum
  • 962
  • 1
  • 10
  • 25
1
vote
1 answer

Error when fit tf.keras.layers.Input into tf.strings.split

I am new the tf, and the question maybe quite naive. I am trying to understand why the Test2 throughs error. # Test 1 x = tf.constant([["aa,bbb,cc"], ["dd,,"]]) tf.strings.split(x, sep=',') =>
user1269298
  • 717
  • 2
  • 8
  • 26
1
vote
0 answers

First-Line Indent and Justified Text

I am trying to create a APA Style Document (following class), but with justified text. \documentclass[stu,11pt,a4paper,helv,biblatex,floatsintext]{apa7} The problem is if I use the following package, it removes all the first-line…
J. Meete
  • 11
  • 2
1
vote
1 answer

Tensorflow: How to use a Ragged Tensor as an index into a normal tensor?

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, 167], [200, 7, 402, 20, 20, 105], ] gives [ …
AAC
  • 563
  • 1
  • 6
  • 18
1
vote
1 answer

In java how to make the user enter number of columns in a ragged array but for each row the number of columns should be different

In java I want to create and print a ragged array , The first thing the user must enter the number of rows and then in each row the user will have to enter the number columns and then put whatever number he wants in each column until he reaches to…
seen20
  • 27
  • 9
1
vote
1 answer

Loss functions converts y_pred to tensor, which means output of a model can't be of RaggedTensor type

I'm trying to train a sequence-to-sequence autoencoder. Input shape is [sample, time_step, input_dim] and the timesteps' length of each sample is different from each other. Here is my model's implementation: input_dim = 385 output_dim = 32 cells =…
Tung
  • 112
  • 2
  • 13
1
vote
1 answer

Concat ragged arrays in Keras

I have several RaggedTensors that I want to concatenate; I am using Keras. Vanilla Tensorflow will happily concatenate them, so I tried the code: card_feature = layers.concatenate([ragged1, ragged2, ragged3]) but it gave the error: Traceback (most…
Alex Meiburg
  • 655
  • 5
  • 20
1
vote
0 answers

How to gather the last X indices embeddings before every grouping of False in a boolean mask for every row in a batch

Mask for input is given, its shape is [batch size, no of timesteps]. From this, I need to collect X number of embeddings of shape [batch size, timestep index, embedding size] such that they are grouped just before each grouping of False. say mask of…
1
vote
1 answer

How to find the intersection between two matrix array in Tensorflow 2.0

return tf.sets.intersection(set_1,set_2) I got the error message with return ops.EagerTensor(value, ctx.device_name, dtype) ValueError: TypeError: object of type 'RaggedTensor' has no len() my set_1 and set_2's type is as following > set_1->…
user11173832
1
vote
1 answer

Broadcasting with ragged tensor

Define x as: >>> import tensorflow as tf >>> x = tf.constant([1, 2, 3]) Why does this normal tensor multiplication work fine with broacasting: >>> tf.constant([[1, 2, 3], [4, 5, 6]]) * tf.expand_dims(x, axis=0)
Vivek Subramanian
  • 1,174
  • 2
  • 17
  • 31