mirror of
https://github.com/JHUAPL/lantern-smt.git
synced 2026-01-09 01:57:55 -05:00
Regenerate documentation
This commit is contained in:
@@ -46,6 +46,21 @@ The 'public' API includes:
|
||||
- as_z3(model, sort, prefix)
|
||||
"""
|
||||
|
||||
# Copyright 2020 The Johns Hopkins University Applied Physics Laboratory LLC
|
||||
# All rights reserved.
|
||||
#
|
||||
# Licensed under the 3-Caluse BSD License (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://opensource.org/licenses/BSD-3-Clause
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import copy
|
||||
import struct
|
||||
from collections import OrderedDict
|
||||
@@ -239,7 +254,7 @@ def as_z3(model, sort=z3.RealSort(), prefix=""):
|
||||
elif isinstance(module, nn.ReLU):
|
||||
in_vector = previous_vector
|
||||
if in_vector is None:
|
||||
raise Exception("First layer must be linear")
|
||||
raise ValueError("First layer must be linear")
|
||||
|
||||
out_vector = const_vector("{}_relu{}_out".format(prefix, name),
|
||||
len(in_vector), sort)
|
||||
@@ -249,7 +264,7 @@ def as_z3(model, sort=z3.RealSort(), prefix=""):
|
||||
elif isinstance(module, nn.Hardtanh):
|
||||
in_vector = previous_vector
|
||||
if in_vector is None:
|
||||
raise Exception("First layer must be linear")
|
||||
raise ValueError("First layer must be linear")
|
||||
|
||||
out_vector = const_vector("{}_tanh{}_out".format(prefix, name),
|
||||
len(in_vector), sort)
|
||||
@@ -262,7 +277,7 @@ def as_z3(model, sort=z3.RealSort(), prefix=""):
|
||||
elif isinstance(module, nn.Identity):
|
||||
pass
|
||||
else:
|
||||
raise Exception("Don't know how to convert module: {}".format(module))
|
||||
raise ValueError("Don't know how to convert module: {}".format(module))
|
||||
|
||||
previous_vector = out_vector
|
||||
|
||||
@@ -363,7 +378,7 @@ characteristics compared to a real arithmetic theory</p>
|
||||
elif isinstance(module, nn.ReLU):
|
||||
in_vector = previous_vector
|
||||
if in_vector is None:
|
||||
raise Exception("First layer must be linear")
|
||||
raise ValueError("First layer must be linear")
|
||||
|
||||
out_vector = const_vector("{}_relu{}_out".format(prefix, name),
|
||||
len(in_vector), sort)
|
||||
@@ -373,7 +388,7 @@ characteristics compared to a real arithmetic theory</p>
|
||||
elif isinstance(module, nn.Hardtanh):
|
||||
in_vector = previous_vector
|
||||
if in_vector is None:
|
||||
raise Exception("First layer must be linear")
|
||||
raise ValueError("First layer must be linear")
|
||||
|
||||
out_vector = const_vector("{}_tanh{}_out".format(prefix, name),
|
||||
len(in_vector), sort)
|
||||
@@ -386,7 +401,7 @@ characteristics compared to a real arithmetic theory</p>
|
||||
elif isinstance(module, nn.Identity):
|
||||
pass
|
||||
else:
|
||||
raise Exception("Don't know how to convert module: {}".format(module))
|
||||
raise ValueError("Don't know how to convert module: {}".format(module))
|
||||
|
||||
previous_vector = out_vector
|
||||
|
||||
|
||||
Reference in New Issue
Block a user