Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
2c2c9ce6
提交
2c2c9ce6
authored
10月 31, 2011
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
whitespace and deleting rotten function in tensor.basic
上级
28d0fee7
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
9 行增加
和
20 行删除
+9
-20
basic.py
theano/tensor/basic.py
+9
-20
没有找到文件。
theano/tensor/basic.py
浏览文件 @
2c2c9ce6
...
...
@@ -1081,6 +1081,7 @@ def tensor4(name=None, dtype=None):
tensor4s
,
ftensor4s
,
dtensor4s
,
itensor4s
,
ltensor4s
=
_multi
(
tensor4
,
ftensor4
,
dtensor4
,
itensor4
,
ltensor4
)
class
_tensor_py_operators
:
#UNARY
def
__abs__
(
self
):
return
abs_
(
self
)
...
...
@@ -1370,10 +1371,14 @@ class _tensor_py_operators:
def
get_constant_value
(
self
):
return
get_constant_value
(
self
)
class
TensorVariable
(
_tensor_py_operators
,
Variable
):
"""Subclass to add the tensor operators to the basic `Variable` class."""
TensorType
.
Variable
=
TensorVariable
class
TensorConstantSignature
(
tuple
):
"""A Signature object for comparing TensorConstant instances
...
...
@@ -1497,7 +1502,8 @@ class TensorValue(_tensor_py_operators, Value):
Tensor
=
TensorType
#QUESTION: why are we doing this!?
# This bizarre push-import avoids a circular dependency.
elemwise
.
as_tensor_variable
=
as_tensor_variable
elemwise
.
TensorType
=
TensorType
elemwise
.
TensorVariable
=
TensorVariable
...
...
@@ -1505,29 +1511,10 @@ elemwise.TensorConstant = TensorConstant
elemwise
.
TensorValue
=
TensorValue
#########################
# Utilities
#########################
def
_elemwise
(
scalar_op
,
name
,
doc_prefix
=
''
):
straight
=
elemwise
.
Elemwise
(
scalar_op
,
name
=
name
)
inplace_scalar_op
=
scalar_op
.
__class__
(
scal
.
transfer_type
(
0
))
inplace
=
elemwise
.
Elemwise
(
inplace_scalar_op
,
{
0
:
0
},
name
=
name
+
"_inplace"
)
# don't add the inplace versions, they aren't supposed to be part of the user interface
_constructor_list
.
append
(
straight
)
# This is here so that gen_oplist can detect which module declared these variables.
straight
.
__module__
=
'tensor'
inplace
.
__module__
=
'tensor'
if
doc_prefix
:
straight
.
__doc__
=
doc_prefix
+
'
\n
'
+
straight
.
__doc__
return
straight
,
inplace
def
_redefine
(
real_symbol_value
,
module
=
'tensor'
):
"""Replace the value associated with a function symbol.
...
...
@@ -1538,12 +1525,14 @@ def _redefine(real_symbol_value, module='tensor'):
return
real_symbol_value
return
decorator
def
_redefine_asRoutine
(
real_symbol_value
):
real_symbol_value
.
__epydoc_asRoutine
=
True
def
decorator
(
f
):
return
real_symbol_value
return
decorator
def
_scal_elemwise_with_nfunc
(
nfunc
,
nin
,
nout
):
"""
Replace a symbol definition with an elementwise version of the
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论