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
chenpangpang
transformers
Commits
d9a81fc0
Unverified
Commit
d9a81fc0
authored
Feb 18, 2021
by
Stas Bekman
Committed by
GitHub
Feb 18, 2021
Browse files
fix func signature (#10271)
parent
c6fe1755
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
tests/test_trainer.py
tests/test_trainer.py
+3
-3
No files found.
tests/test_trainer.py
View file @
d9a81fc0
...
@@ -146,7 +146,7 @@ if is_torch_available():
...
@@ -146,7 +146,7 @@ if is_torch_available():
self
.
double_output
=
double_output
self
.
double_output
=
double_output
self
.
config
=
None
self
.
config
=
None
def
forward
(
self
,
input_x
=
None
,
labels
=
None
,
**
kwargs
):
def
forward
(
self
,
input_x
,
labels
=
None
,
**
kwargs
):
y
=
input_x
*
self
.
a
+
self
.
b
y
=
input_x
*
self
.
a
+
self
.
b
if
labels
is
None
:
if
labels
is
None
:
return
(
y
,
y
)
if
self
.
double_output
else
(
y
,)
return
(
y
,
y
)
if
self
.
double_output
else
(
y
,)
...
@@ -160,7 +160,7 @@ if is_torch_available():
...
@@ -160,7 +160,7 @@ if is_torch_available():
self
.
b
=
torch
.
nn
.
Parameter
(
torch
.
tensor
(
b
).
float
())
self
.
b
=
torch
.
nn
.
Parameter
(
torch
.
tensor
(
b
).
float
())
self
.
config
=
None
self
.
config
=
None
def
forward
(
self
,
input_x
=
None
,
labels
=
None
,
**
kwargs
):
def
forward
(
self
,
input_x
,
labels
=
None
,
**
kwargs
):
y
=
input_x
*
self
.
a
+
self
.
b
y
=
input_x
*
self
.
a
+
self
.
b
result
=
{
"output"
:
y
}
result
=
{
"output"
:
y
}
if
labels
is
not
None
:
if
labels
is
not
None
:
...
@@ -177,7 +177,7 @@ if is_torch_available():
...
@@ -177,7 +177,7 @@ if is_torch_available():
self
.
b
=
torch
.
nn
.
Parameter
(
torch
.
tensor
(
config
.
b
).
float
())
self
.
b
=
torch
.
nn
.
Parameter
(
torch
.
tensor
(
config
.
b
).
float
())
self
.
double_output
=
config
.
double_output
self
.
double_output
=
config
.
double_output
def
forward
(
self
,
input_x
=
None
,
labels
=
None
,
**
kwargs
):
def
forward
(
self
,
input_x
,
labels
=
None
,
**
kwargs
):
y
=
input_x
*
self
.
a
+
self
.
b
y
=
input_x
*
self
.
a
+
self
.
b
if
labels
is
None
:
if
labels
is
None
:
return
(
y
,
y
)
if
self
.
double_output
else
(
y
,)
return
(
y
,
y
)
if
self
.
double_output
else
(
y
,)
...
...
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