Skip to content

Commit

Permalink
Fix vectorization for stft (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanklosko committed Aug 30, 2023
1 parent 4f1ee15 commit e387d0d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/nx_signal.ex
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ defmodule NxSignal do
output = Nx.broadcast(Nx.tensor(0, type: tensor.type), output_shape)
{num_windows, _} = Nx.shape(output)

[output, tensor] = Nx.broadcast_vectors([output, tensor])

{output, _, _, _} =
while {output, i = 0, current_window = 0, t = tensor}, current_window < num_windows do
window = t |> Nx.slice([i], [window_length])
Expand Down

0 comments on commit e387d0d

Please sign in to comment.