Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
torch-harmonics
Commits
763d4371
Commit
763d4371
authored
Jul 16, 2025
by
Andrea Paris
Browse files
small bf16 fix for w11 loss
parent
6ac50e26
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
torch_harmonics/examples/losses.py
torch_harmonics/examples/losses.py
+9
-5
No files found.
torch_harmonics/examples/losses.py
View file @
763d4371
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
import
torch
import
torch
import
torch.nn
as
nn
import
torch.nn
as
nn
import
torch.amp
as
amp
import
torch.nn.functional
as
F
import
torch.nn.functional
as
F
from
typing
import
Optional
from
typing
import
Optional
from
abc
import
ABC
,
abstractmethod
from
abc
import
ABC
,
abstractmethod
...
@@ -259,6 +260,9 @@ class W11LossS2(SphericalLossBase):
...
@@ -259,6 +260,9 @@ class W11LossS2(SphericalLossBase):
self
.
register_buffer
(
"k_theta_mesh"
,
k_theta_mesh
)
self
.
register_buffer
(
"k_theta_mesh"
,
k_theta_mesh
)
def
_compute_loss_term
(
self
,
prd
:
torch
.
Tensor
,
tar
:
torch
.
Tensor
)
->
torch
.
Tensor
:
def
_compute_loss_term
(
self
,
prd
:
torch
.
Tensor
,
tar
:
torch
.
Tensor
)
->
torch
.
Tensor
:
prdtype
=
prd
.
dtype
with
amp
.
autocast
(
device_type
=
"cuda"
,
enabled
=
False
):
prd
=
prd
.
to
(
torch
.
float32
)
prd_prime_fft2_phi_h
=
torch
.
fft
.
ifft2
(
1j
*
self
.
k_phi_mesh
*
torch
.
fft
.
fft2
(
prd
)).
real
prd_prime_fft2_phi_h
=
torch
.
fft
.
ifft2
(
1j
*
self
.
k_phi_mesh
*
torch
.
fft
.
fft2
(
prd
)).
real
prd_prime_fft2_theta_h
=
torch
.
fft
.
ifft2
(
1j
*
self
.
k_theta_mesh
*
torch
.
fft
.
fft2
(
prd
)).
real
prd_prime_fft2_theta_h
=
torch
.
fft
.
ifft2
(
1j
*
self
.
k_theta_mesh
*
torch
.
fft
.
fft2
(
prd
)).
real
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment