Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tayloranalysis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Sowa
tayloranalysis
Commits
fc1d05cd
Commit
fc1d05cd
authored
1 year ago
by
Lars Sowa
Browse files
Options
Downloads
Patches
Plain Diff
fix tests, add docu
parent
41f792d4
Branches
Branches containing commit
No related tags found
1 merge request
!9
Flex tensor dev
Pipeline
#3452
passed
1 year ago
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/tayloranalysis/cls.py
+1
-0
1 addition, 0 deletions
src/tayloranalysis/cls.py
tests/test_model_extention.py
+6
-6
6 additions, 6 deletions
tests/test_model_extention.py
with
7 additions
and
6 deletions
src/tayloranalysis/cls.py
+
1
−
0
View file @
fc1d05cd
...
...
@@ -338,6 +338,7 @@ class BaseTaylorAnalysis(object):
reduce_func (Callable, optional): Function to reduce the taylorcoefficients. Defaults to identity.
features_axis (int, optional): Dimension containing features in tensor forward_kwargs.deriv_target. Defaults to -1.
output_idx (Union[int, None], optional): Index of the target tensor if forward_kwargs[target_key] is a list. Defaults to None.
keep_model_output (int, optional): Index of the model output if its output is a sequence. Defaults to 0.
Raises:
ValueError: index_list must be a List of tuples!
...
...
This diff is collapsed.
Click to expand it.
tests/test_model_extention.py
+
6
−
6
View file @
fc1d05cd
...
...
@@ -54,7 +54,7 @@ class TestBaseClass:
)
]
for
index
in
combinations
:
for
eval_max_node_only
in
[
False
,
True
]:
for
eval_max_
output_
node_only
in
[
False
,
True
]:
node_outputs
=
[]
for
node
in
range
(
mlp_specs
[
"
output_neurons
"
]):
# get singe node results
...
...
@@ -62,8 +62,8 @@ class TestBaseClass:
"
x
"
,
forward_kwargs
=
{
"
x
"
:
x_data
},
index_list
=
[
index
],
node
=
node
,
eval_max_node_only
=
eval_max_node_only
,
output_
node
=
node
,
eval_max_
output_
node_only
=
eval_max_
output_
node_only
,
)
tc
=
tc
[
index
]
node_outputs
.
append
(
tc
)
...
...
@@ -72,14 +72,14 @@ class TestBaseClass:
"
x
"
,
forward_kwargs
=
{
"
x
"
:
x_data
},
index_list
=
[
index
],
node
=
None
,
eval_max_node_only
=
eval_max_node_only
,
output_
node
=
None
,
eval_max_
output_
node_only
=
eval_max_
output_
node_only
,
)
tc
=
tc
[
index
]
# sums should be equal
node_outputs
=
torch
.
stack
(
node_outputs
,
dim
=-
1
).
sum
(
dim
=-
1
)
with
unittest
.
TestCase
().
subTest
(
index
=
index
,
eval_max_node_only
=
eval_max_node_only
index
=
index
,
eval_max_
output_
node_only
=
eval_max_
output_
node_only
):
# check if tensors are close
is_close
=
torch
.
testing
.
assert_close
(
tc
,
node_outputs
)
==
None
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment