Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nianchen Deng
deeplightfield
Commits
3e1a5b04
Commit
3e1a5b04
authored
Dec 25, 2020
by
BobYeah
Browse files
sync
parent
67c4de9e
Changes
2
Show whitespace changes
Inline
Side-by-side
msl_net.py
0 → 100644
View file @
3e1a5b04
from
typing
import
List
import
torch
import
torch.nn
as
nn
from
.pytorch_prototyping.pytorch_prototyping
import
*
from
.my
import
util
from
.my
import
device
class
FcNet
(
nn
.
Module
):
def
__init__
(
self
,
in_chns
,
out_chns
,
nf
,
n_layers
):
super
().
__init__
()
self
.
layers
=
list
()
self
.
layers
.
append
(
nn
.
Linear
(
in_chns
,
nf
))
self
.
layers
.
append
(
nn
.
LeakyReLU
())
for
_
in
range
(
1
,
n_layers
):
self
.
layers
.
append
(
nn
.
Linear
(
nf
,
nf
))
self
.
layers
.
append
(
nn
.
LeakyReLU
())
self
.
layers
.
append
(
nn
.
Linear
(
nf
,
out_chns
))
self
.
net
=
nn
.
Sequential
(
*
self
.
layers
)
def
forward
(
self
,
x
):
return
self
.
net
(
x
)
class
Rendering
(
nn
.
Module
):
def
__init__
(
self
,
n_sphere_layers
):
super
().
__init__
()
self
.
n_sl
=
n_sphere_layers
def
forward
(
self
,
net
,
pos
,
dir
):
"""
[summary]
:param pos: B x 3, position of a ray
:param dir: B x 3, direction of a ray
"""
class
MslNet
(
nn
.
Module
):
def
__init__
(
self
):
super
().
__init__
()
def
forward
(
self
,
x
):
run_lf_syn.py
View file @
3e1a5b04
...
...
@@ -27,7 +27,7 @@ BATCH_SIZE = 8
TEST_BATCH_SIZE
=
10
NUM_EPOCH
=
1000
MODE
=
"Silence"
# "Perf"
EPOCH_BEGIN
=
0
EPOCH_BEGIN
=
60
0
def
train
():
...
...
@@ -58,7 +58,7 @@ def train():
# 3. Train
model
.
train
()
epoch
=
EPOCH_BEGIN
iters
=
EPOCH_BEGIN
*
len
(
train_data_loader
)
iters
=
EPOCH_BEGIN
*
len
(
train_data_loader
)
*
BATCH_SIZE
util
.
CreateDirIfNeed
(
RUN_DIR
)
...
...
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