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
gaoqiong
MIGraphX
Commits
9ace3b74
Commit
9ace3b74
authored
Jun 02, 2018
by
Scott Thornton
Browse files
Added a few binary operators
parent
742e6a4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
0 deletions
+74
-0
src/include/rtg/operators.hpp
src/include/rtg/operators.hpp
+74
-0
No files found.
src/include/rtg/operators.hpp
View file @
9ace3b74
...
@@ -246,6 +246,80 @@ struct gemm
...
@@ -246,6 +246,80 @@ struct gemm
}
}
};
};
struct
identity
{
std
::
string
name
()
const
{
return
"identity"
;
}
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
{
check_shapes
{
inputs
}.
has
(
1
);
return
inputs
.
at
(
0
);
}
};
struct
softmax
{
std
::
string
name
()
const
{
return
"softmax"
;
}
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
{
check_shapes
{
inputs
}.
has
(
1
);
return
inputs
.
at
(
0
);
}
};
struct
flatten
{
std
::
string
name
()
const
{
return
"flatten"
;
}
};
struct
add_op
{
std
::
string
name
()
const
{
return
"add"
;
}
};
struct
sub_op
{
std
::
string
name
()
const
{
return
"sub"
;
}
};
struct
mul_op
{
std
::
string
name
()
const
{
return
"mul"
;
}
};
struct
div_op
{
std
::
string
name
()
const
{
return
"div"
;
}
};
struct
max_op
{
std
::
string
name
()
const
{
return
"max"
;
}
};
struct
min_op
{
std
::
string
name
()
const
{
return
"min"
;
}
};
// max, min, add, sub
template
<
typename
Op
>
struct
binaryop
{
Op
op
;
std
::
string
name
()
const
{
op
.
name
();
}
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
{
// TODO(wsttiger@gmail.com) Check this for numpy-style broadcasting operations
check_shapes
{
inputs
}.
has
(
2
).
same_type
().
same_dims
();
return
inputs
.
at
(
0
);
}
};
struct
reduce
{
std
::
string
name
()
const
{
return
"reduce"
;
}
};
}
// namespace rtg
}
// namespace rtg
#endif
#endif
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