U
    d                     @   sJ   d dl mZ d dlmZ d dlmZ d dlZd dlZG dd deeZ	dS )    )schema)
ModelLayer)SamplingTrainableMixinNc                       s2   e Zd Zd
 fdd	Zdd Zedd	 Z  ZS )FCWithoutBiasNfc_without_bias      ?c                    s   t t| j|||f| t|tjs,tdt| d j	dksJtd| d j	d }	|	dksrtd
|	ttj|ff| d| _t||	 }
|r|nd|
 |
df}| jd||	g||d	| _d S )
NzIncorrect input typer   z<FCWithoutBias expects limited dimensions of the input tensorz2FCWithoutBias expects input dimensions > 0, got {}outputZUniformFill)minmaxw)
param_nameshapeZinitializerZ	optimizer)superr   __init__
isinstancer   ZScalarAssertionErrorlenZfield_typesr   formatnpZfloat32Zget_next_blob_referenceoutput_schemamathsqrtZcreate_paramr   )selfmodelinput_recordZoutput_dimsZweight_initZweight_optimnameZ#uniform_weight_init_scale_numeratorkwargsZ
input_dimsZscale	__class__ H/tmp/pip-unpacked-wheel-ua33x9lu/caffe2/python/layers/fc_without_bias.pyr      s2    

 zFCWithoutBias.__init__c                 C   s.   |j | j | | j fddi| j d S )NZtrans_b   )ZMatMulr   Zfield_blobsr   r   )r   netparamsr   r   r    _add_ops7   s    zFCWithoutBias._add_opsc                 C   s   | j gS )N)r   )r   r   r   r    param_blobs=   s    zFCWithoutBias.param_blobs)NNr   r   )__name__
__module____qualname__r   r$   propertyr%   __classcell__r   r   r   r    r      s       &r   )
Zcaffe2.pythonr   Zcaffe2.python.layers.layersr   Z-caffe2.python.layers.sampling_trainable_mixinr   r   Znumpyr   r   r   r   r   r    <module>   s
   