# AttributeError: 'ImmutableDenseNDimArray' object has no attribute 'expand'

Need help to compute the integrate equation of `∫x(t)*e^(-st) dt` where `x(t)` is my original signal after `ifft calculation`. The result shows the follwing error `AttributeError: 'ImmutableDenseNDimArray' object has no attribute 'expand'`. How can I resolve this issue?
Here is my code:

``````import torch
import numpy as np
import matplotlib.pyplot as plt
import os
from scipy import signal
import math
import scipy
import sympy as sym

os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"

f_s = 48000
f_c = 16000
f_l = 19000
f_r = 17000
b = f_l - f_r
n_order = 5
cut_off = 10

def high_pass_filter():
# generate a random signal
array_list = np.random.randn(1, 100, 1000)

tensor_array = torch.from_numpy(array_list)

reshape_tensor = tensor_array.reshape(2, 10, -1)

reshape_img = reshape_tensor.reshape(-1)

# compute the fft
fft_signal = torch.fft.fft(reshape_tensor)
print(fft_signal)
reshape_fft_signal = fft_signal.reshape(-1)
normalize_cutoff = (((f_c - b)/cut_off) / 2) / (f_s/2)  # normalize cut_off
print("normalize : ", normalize_cutoff)
down = math.sqrt(1 + ((f_c / normalize_cutoff)**(2*n_order)))
print("down reponse : ", down)

butterworth = torch.tensor(1 / down)

G = torch.mul(butterworth, fft_signal)
G_reshape = G.reshape(-1)
output_filter = torch.fft.ifft2(G)
print(output_filter)
output_filter_reshape = output_filter.reshape(-1)

plt.figure()
plt.plot(reshape_img)
plt.figure()
plt.plot(reshape_fft_signal)
plt.figure()
plt.plot(G_reshape)
plt.figure()
plt.plot(output_filter_reshape)
# plt.show()
return output_filter

def pole_zero_plot(poles, zeros, ax=None):
for pole in poles:
plt.plot(complex(pole).real, complex(pole).imag, 'rx', markersize=10)
for zero in zeros:
plt.plot(complex(zero).real, complex(zero).imag, 'bo', markersize=10)

if ax is None:
ax = plt.gca()
ax.set_aspect(1)

plt.axis([-2, 2, -2, 2])
plt.xlabel(r'\$\Re\{s\}')
plt.ylabel(r'\$\Im\{s\}')
plt.grid()

if __name__ == '__main__':
sym.init_printing()

signal = high_pass_filter()
signal_numpy = signal.detach().numpy()

t = sym.symbols('t', real=True)
s = sym.symbols('s', complex=True)

X = sym.integrate(signal_numpy * sym.exp(-s * t), (t, -sym.oo, sym.oo))
print(X)

``````

Error: `X = sym.integrate(signal_numpy * sym.exp(-s * t), (t, -sym.oo, sym.oo))`

Thanks…

The issue seems to be raised by `sympy` or are you only seeing it when PyTorch tensors are used?
In the former case, you might want to post in a `sympy`-specific discussion board or in their GitHub repository to get a faster answer from the devs.

The error claim is after converted datas from tensor to numpy `signal_numpy = signal.detach().numpy()`. While using tensors here the problem `TypeError: unsupported operand type(s) for *: 'Tensor' and 'exp'`. You are right, the main issue pointed on `sympy`, but how to match my data to this module. What the difference while using real data or random data, instead of using the simple equation?