Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
07b8cb31
提交
07b8cb31
authored
5月 09, 2008
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
差异文件
merged
上级
89e37be9
476b2727
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
28 行增加
和
2 行删除
+28
-2
_test_scalar.py
_test_scalar.py
+13
-0
scalar.py
scalar.py
+8
-0
tensor.py
tensor.py
+7
-2
没有找到文件。
_test_scalar.py
浏览文件 @
07b8cb31
...
...
@@ -82,6 +82,19 @@ class _test_logical(unittest.TestCase):
for
a
,
b
in
((
3.
,
9
),
(
3
,
0.9
),
(
3
,
3
)):
self
.
failUnless
(
fn
(
a
,
b
)
==
(
a
>=
b
))
def
test_eq
(
self
):
x
,
y
,
z
=
inputs
()
fn
=
gof
.
DualLinker
(
Env
([
x
,
y
],
[
eq
(
x
,
y
)]))
.
make_function
()
for
a
,
b
in
((
3.
,
9
),
(
3
,
0.9
),
(
3
,
3
)):
self
.
failUnless
(
fn
(
a
,
b
)
==
(
a
==
b
))
def
test_neq
(
self
):
x
,
y
,
z
=
inputs
()
fn
=
gof
.
DualLinker
(
Env
([
x
,
y
],
[
neq
(
x
,
y
)]))
.
make_function
()
for
a
,
b
in
((
3.
,
9
),
(
3
,
0.9
),
(
3
,
3
)):
self
.
failUnless
(
fn
(
a
,
b
)
==
(
a
!=
b
))
def
test_or
(
self
):
x
,
y
,
z
=
ints
(
'xyz'
)
fn
=
gof
.
DualLinker
(
Env
([
x
,
y
],
[
x
|
y
]))
.
make_function
()
...
...
scalar.py
浏览文件 @
07b8cb31
...
...
@@ -388,6 +388,14 @@ class EQ(LogicalComparison):
return
x
==
y
eq
=
EQ
()
class
NEQ
(
LogicalComparison
):
identity
=
False
commutative
=
True
associative
=
False
def
impl
(
self
,
x
,
y
):
return
x
!=
y
neq
=
NEQ
()
####################
# BIT-WISE OPERATORS
####################
...
...
tensor.py
浏览文件 @
07b8cb31
...
...
@@ -6,7 +6,7 @@ import numpy
from
copy
import
copy
from
gof
import
Result
,
Op
,
utils
,
AbstractFunctionError
,
Type
,
Result
,
Constant
,
Apply
,
Value
from
gof
import
Result
,
Op
,
utils
,
AbstractFunctionError
,
Type
,
Constant
,
Apply
,
Value
import
gof
import
blas
# for gemm, dot
...
...
@@ -14,10 +14,13 @@ import gradient
import
elemwise
as
s2t
import
scalar
as
scal
from
gof.python25
import
partial
### set up the external interface
from
elemwise
import
Elemwise
,
DimShuffle
,
CAReduce
import
tensor_random
as
random
from
gof.python25
import
partial
def
as_tensor
(
x
,
name
=
None
):
...
...
@@ -518,6 +521,8 @@ lt, lt_inplace = _elemwise(scal.lt, 'lt')
gt
,
gt_inplace
=
_elemwise
(
scal
.
gt
,
'gt'
)
le
,
le_inplace
=
_elemwise
(
scal
.
le
,
'le'
)
ge
,
ge_inplace
=
_elemwise
(
scal
.
ge
,
'ge'
)
eq
,
eq_inplace
=
_elemwise
(
scal
.
eq
,
'eq'
)
neq
,
neq_inplace
=
_elemwise
(
scal
.
neq
,
'neq'
)
##########################
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论