mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: Add sub operator for caffe2 Test Plan: ``` buck test //caffe2/torch/fb/model_transform/c2_convert:c2_pt_converter_test ``` Reviewed By: houseroad Differential Revision: D24685090 fbshipit-source-id: 60d745065d01b634ebd3087e533d8b9ddab77a1f
32 lines
733 B
Python
32 lines
733 B
Python
## @package algebra
|
|
# Module caffe2.python.helpers.algebra
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def transpose(model, blob_in, blob_out, use_cudnn=False, **kwargs):
|
|
"""Transpose."""
|
|
if use_cudnn:
|
|
kwargs['engine'] = 'CUDNN'
|
|
return model.net.Transpose(blob_in, blob_out, **kwargs)
|
|
|
|
|
|
def sum(model, blob_in, blob_out, **kwargs):
|
|
"""Sum"""
|
|
return model.net.Sum(blob_in, blob_out, **kwargs)
|
|
|
|
|
|
def sub(model, blob_in, blob_out, **kwargs):
|
|
"""Subtract"""
|
|
return model.net.Sub(blob_in, blob_out, **kwargs)
|
|
|
|
|
|
def batch_mat_mul(model, blob_in, blob_out,
|
|
enable_tensor_core=False, **kwargs):
|
|
if enable_tensor_core:
|
|
kwargs['engine'] = 'TENSORCORE'
|
|
|
|
return model.net.BatchMatMul(blob_in, blob_out, **kwargs)
|