// ----------------------------------------------
scattering = Scattering3D(M=M, N=N, O=O, J=J, L=L, sigma_0=1.)
x_data = torch.randn(batch_size, M, N, O).float()
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Benchmark the PyTorch backend
// -----------------------------
// If we"re using the this backend, compute scattering transforms both on CPU
// and GPU so that we can compare performance.
if backend.NAME == "torch":
devices = ["cpu"]
if torch.cuda.is_available():
devices.append("gpu")
for device in devices:
fmt_str = "==> Testing Float32 with Torch backend, on {}, forward"
print(fmt_str.format(device.upper()))
if device == "gpu":
scattering.cuda()
x_data = x_data.cuda()
else:
scattering.cpu()
x_data = torch.randn(1, M, N, O).float()
x_data = x_data.cpu()
After Change
if device == "gpu":
x = x.cuda()
else:
x = x.cpu()
scattering.forward(x, method="integral", integral_powers=integral_powers)
if device == "gpu":