text
stringlengths
81
112k
The type of this inline shape as a member of ``docx.enum.shape.WD_INLINE_SHAPE``, e.g. ``LINKED_PICTURE``. Read-only. def type(self): """ The type of this inline shape as a member of ``docx.enum.shape.WD_INLINE_SHAPE``, e.g. ``LINKED_PICTURE``. Read-only. """ ...
Extracts the data from a Plotly Figure Parameters ---------- figure : plotly_figure Figure from which data will be extracted Returns a DataFrame or list of DataFrame def to_df(figure): """ Extracts the data from a Plotly Figure Parameters ----...
Converts from hex|rgb to rgba Parameters: ----------- color : string Color representation on hex or rgb alpha : float Value from 0 to 1.0 that represents the alpha value. Example: to_rgba('#E1E5ED',0.6) ...
Converts from hex to rgb Parameters: ----------- color : string Color representation on hex or rgb Example: hex_to_rgb('#E1E5ED') hex_to_rgb('#f03') def hex_to_rgb(color): """ Converts from hex to rgb Parameters: ----------- ...
Returns an hex color Parameters: ----------- color : string Color representation in rgba|rgb|hex Example: normalize('#f03') def normalize(color): """ Returns an hex color Parameters: ----------- color : string Co...
Converts from rgb to hex Parameters: ----------- color : string Color representation on hex or rgb Example: rgb_to_hex('rgb(23,25,24)') def rgb_to_hex(color): """ Converts from rgb to hex Parameters: ----------- color : string ...
Converts from rgba to rgb Parameters: ----------- color : string Color representation in rgba bg : string Color representation in rgb Example: rgba_to_rgb('rgb(23,25,24,.4)'' def rgba_to_rgb(color, bg='rgb(255,255,255)'): """...
Converts from hex to hsv Parameters: ----------- color : string Color representation on color Example: hex_to_hsv('#ff9933') def hex_to_hsv(color): """ Converts from hex to hsv Parameters: ----------- color : string ...
Generates a scale of colours from a base colour Parameters: ----------- color : string Color representation in hex N : int number of colours to generate Example: color_range('#ff9933',20) def color_range(color, N=20): """ ...
Generates a colour table Parameters: ----------- color : string | list | dict Color representation in rgba|rgb|hex If a list of colors is passed then these are displayed in a table N : int number of colou...
Returns a generator with a list of colors and gradients of those colors Parameters: ----------- colors : list(colors) List of colors to use Example: colorgen() colorgen(['blue','red','pink']) colorgen(['#f03','rgb(23,25,25)']) def co...
Displays a color scale (HTML) Parameters: ----------- scale : str Color scale name If no scale name is provided then all scales are returned (max number for each scale) If scale='all' then all scale combinations...
Returns a color scale Parameters: ----------- scale : str Color scale name If the color name is preceded by a minus (-) then the scale is inversed n : int Number of colors If n < numbe...
Returns a color scale to be used for a plotly figure Parameters: ----------- scale : str or list Color scale name If the color name is preceded by a minus (-) then the scale is inversed. Also accepts a list of colors (...
Generates a plotly Data object Parameters ---------- colors : list or dict {key:color} to specify the color for each column [colors] to use the colors in the defined order colorscale : str Color scale name Only valid if 'colors' is null See cufflinks.colors.scales() for available scales kind :...
Returns a plotly chart either as inline chart, image of Figure object Parameters: ----------- kind : string Kind of chart scatter bar box spread ratio heatmap surface histogram bubble bubble3d scatter3d scattergeo ohlc candle pie choroplet data...
Returns a dict with an item per key Parameters: ----------- items : string, list or dict Items (ie line styles) keys: list List of keys items_names : string Name of items def get_items_as_list(items,keys,items_names='styles'): """ Returns a dict with an item per key Parameters: ----------- it...
Displays a matrix with scatter plot for each pair of Series in the DataFrame. The diagonal shows a histogram for each of the Series Parameters: ----------- df : DataFrame Pandas DataFrame theme : string Theme to be used (if not the default) bins : int Number of bins to use for histogram color : s...
Plots a figure in IPython, creates an HTML or generates an Image figure : figure Plotly figure to be charted validate : bool If True then all values are validated before it is charted sharing : string Sets the sharing level permission public - anyone can see this chart private - only you can see this...
Generates a Technical Study Chart Parameters: ----------- study : string Technical Study to be charted sma - 'Simple Moving Average' rsi - 'R Strength Indicator' periods : int Number of periods column : string Name of the column on which the study will be done include : bool ...
Plots a figure in IPython figure : figure Plotly figure to be charted validate : bool If True then all values are validated before it is charted sharing : string Sets the sharing level permission public - anyone can see this chart private - only you can see this chart secret - only people with the...
Ensure that filesystem is setup/filled out in a valid way def ensure_local_files(): """ Ensure that filesystem is setup/filled out in a valid way """ if _file_permissions: if not os.path.isdir(AUTH_DIR): os.mkdir(AUTH_DIR) for fn in [CONFIG_FILE]: contents = load_json_dict(fn) for key, val in list(_FI...
Set the keyword-value pairs in `~/.config`. sharing : string Sets the sharing level permission public - anyone can see this chart private - only you can see this chart secret - only people with the link can see the chart theme : string Sets the default theme See cufflinks.getThemes() for availab...
Checks if file exists. Returns {} if something fails. def load_json_dict(filename, *args): """Checks if file exists. Returns {} if something fails.""" data = {} if os.path.exists(filename): with open(filename, "r") as f: try: data = json.load(f) if not isinstance(data, dict): data = {} except: ...
Will error if filename is not appropriate, but it's checked elsewhere. def save_json_dict(filename, json_dict): """Will error if filename is not appropriate, but it's checked elsewhere. """ if isinstance(json_dict, dict): with open(filename, "w") as f: f.write(json.dumps(json_dict, indent=4)) else: raise Ty...
Returns a dictionary with the schema for a QuantFigure def _get_schema(self): """ Returns a dictionary with the schema for a QuantFigure """ d={} layout_kwargs=dict((_,'') for _ in get_layout_kwargs()) for _ in ('data','layout','theme','panels'): d[_]={} for __ in eval('__QUANT_FIGURE_{0}'.format(_....
Returns a sliced DataFrame Parameters ---------- slice : tuple(from,to) from : str to : str States the 'from' and 'to' values which will get rendered as df.ix[from:to] df : DataFrame If omitted then the QuantFigure.DataFrame is resampled. def _get_sliced(self,slice,df=None): """ R...
Returns a resampled DataFrame Parameters ---------- rule : str the offset string or object representing target conversion for all aliases available see http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases how : str or dict states the form in which the resampling will be done...
Updates the values for a QuantFigure The key-values are automatically assigned to the correct section of the QuantFigure def update(self,**kwargs): """ Updates the values for a QuantFigure The key-values are automatically assigned to the correct section of the QuantFigure """ if 'columns' in kwargs: ...
Deletes the values for a QuantFigure The key-values are automatically deleted from the correct section of the QuantFigure def delete(self,*args): """ Deletes the values for a QuantFigure The key-values are automatically deleted from the correct section of the QuantFigure """ if args: args=args[0] ...
Returns the panel domains for each axis def _panel_domains(self,n=2,min_panel_size=.15,spacing=0.08,top_margin=1,bottom_margin=0): """ Returns the panel domains for each axis """ d={} for _ in range(n+1,1,-1): lower=round(bottom_margin+(min_panel_size+spacing)*(n+1-_),2) d['yaxis{0}'.format(_)]=dic...
Returns a trendline (line), support or resistance Parameters: date0 : string Trendline starting date date1 : string Trendline end date on : string Indicate the data series in which the trendline should be based. 'close' 'high' 'low' 'open' kind : string Def...
Adds a trendline to the QuantFigure. Given 2 dates, the trendline is connected on the data points that correspond to those dates. Parameters: date0 : string Trendline starting date date1 : string Trendline end date on : string Indicate the data series in which the trendline should be...
Adds a support line to the QuantFigure Parameters: date0 : string The support line will be drawn at the 'y' level value that corresponds to this date. on : string Indicate the data series in which the support line should be based. 'close' 'high' 'low' 'open' mode : str...
Add an annotation to the QuantFigure. Parameters: annotations : dict or list(dict,) Annotations can be on the form form of {'date' : 'text'} and the text will automatically be placed at the right level on the chart or A Plotly fully defined annotation kwargs : fontcolor : st...
Add a shape to the QuantFigure. kwargs : hline : int, list or dict Draws a horizontal line at the indicated y position(s) Extra parameters can be passed in the form of a dictionary (see shapes) vline : int, list or dict Draws a vertical line at the indicated x position(s) Extra pa...
Adds a study to QuantFigure.studies Parameters: study : dict {'kind':study_kind, 'params':study_parameters, 'display':display_parameters} def _add_study(self,study): """ Adds a study to QuantFigure.studies Parameters: study : dict {'kind':study_kind, 'params':study_parameters, ...
Add 'volume' study to QuantFigure.studies Parameters: colorchange : bool If True then each volume bar will have a fill color depending on if 'base' had a positive or negative change compared to the previous value If False then each volume bar will have a fill color depending on if the volume...
Add Moving Average Convergence Divergence (MACD) study to QuantFigure.studies Parameters: fast_period : int MACD Fast Period slow_period : int MACD Slow Period signal_period : int MACD Signal Period column :string Defines the data column name that contains the data over which the stu...
Add Simple Moving Average (SMA) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods column :string Defines the data column name that contains the data over which the study will be applied. Default: 'close' name : string Name given to the study str :...
Add Relative Strength Indicator (RSI) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods rsi_upper : int bounds [0,100] Upper (overbought) level rsi_lower : int bounds [0,100] Lower (oversold) level showbands : boolean If True, then the rsi_uppe...
Add Bollinger Bands (BOLL) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods boll_std : int Number of standard deviations for the bollinger upper and lower bands fill : boolean If True, then the innner area of the bands will filled column :string ...
Commodity Channel Indicator study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods cci_upper : int Upper bands level default : 100 cci_lower : int Lower band level default : -100 showbands : boolean If True, then the cci_upper and cci_lower level...
Add Parabolic SAR (PTPS) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods af : float acceleration factor initial : 'long' or 'short' Iniital position default: long name : string Name given to the study str : string Label factory for studies ...
Add Average True Range (ATR) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods name : string Name given to the study str : string Label factory for studies The following wildcards can be used: {name} : Name of the column {study} : Name of the stu...
connected : bool If True, the plotly.js library will be loaded from an online CDN. If False, the plotly.js library will be loaded locally from the plotly python package def go_offline(connected=None): """ connected : bool If True, the plotly.js library will be loaded fro...
Filters a DataFrame for columns that contain the given strings. Parameters: ----------- include : bool If False then it will exclude items that match the given filters. This is the same as passing a regex ^keyword kwargs : Key value pairs that indicate the column and value to screen for Examp...
Returns a series with the bestfit values. Example: Series.bestfit() Returns: series The returned series contains a parameter called 'formula' which includes the string representation of the bestfit line. def bestfit(self): """ Returns a series with the bestfit values. Example: Series.bestfit() ...
Returns a normalized series or DataFrame Example: Series.normalize() Returns: series of DataFrame Parameters: ----------- asOf : string Date format '2015-02-29' multiplier : int Factor by which the results will be adjusted def normalize(self,asOf=None,multiplier=100): """ Returns a normalized...
d1 <-- d2 def merge_dict(d1,d2): """ d1 <-- d2 """ d=copy.deepcopy(d2) for k,v in list(d1.items()): if k not in d: d[k]=v else: if isinstance(v,dict): d[k]=merge_dict(d1[k],d[k]) return d
Returns a dictionary with the path in which each of the keys is found Parameters: from_d : dict Dictionary that contains all the keys, values to_d : dict Dictionary to which the results will be appended Example: dict_path({'level1':{'level2':{'level3':'value'}}}) Returns {'level1': [], 'level...
Formats (prettyprint) a concatenated dictionary def pp(el,preString=''): """ Formats (prettyprint) a concatenated dictionary """ tab=' '*4 if isinstance(el,dict): keys=list(el.keys()) keys.sort() for key in keys: val=el[key] if isinstance(val,dict) or isinstance(val,list): print('%s%s :' % (preSt...
Returns a dictionay indexed by values {value_k:key_k} Parameters: ----------- d : dictionary def inverseDict(d): """ Returns a dictionay indexed by values {value_k:key_k} Parameters: ----------- d : dictionary """ dt={} for k,v in list(d.items()): if type(v) in (list,tuple): for i in v: dt[i]=k ...
Looks for keys of the format keyword_value. And return a dictionary with {keyword:value} format Parameters: ----------- from_kwargs : dict Original dictionary to_kwargs : dict Dictionary where the items will be appended keyword : string Keyword to look for in the orginal dictionary clean_origin : ...
Updates the values (deep form) of a given dictionary Parameters: ----------- d : dict dictionary that contains the values to update d_update : dict dictionary to be updated def deep_update(d,d_update): """ Updates the values (deep form) of a given dictionary Parameters: ----------- d : dict dict...
Reads a google sheet def read_google(self,url,**kwargs): """ Reads a google sheet """ if url[-1]!='/': url+='/' return self.read_csv(url+'export?gid=0&format=csv',**kwargs)
Returns a string that represents a date n numbers of days from today. Parameters: ----------- delta : int number of days strfmt : string format in which the date will be represented def getDateFromToday(delta,strfmt='%Y%m%d'): """ Returns a string that represents a date n numbers of days from today. Par...
Returns a dictionary with the actual column names that correspond to each of the OHLCV values. df_or_figure : DataFrame or Figure open : string Column name to be used for OPEN values high : string Column name to be used for HIGH values low : string Column name to be used for LOW values close : string C...
how : string value pct_chg diff def correl(df,periods=21,columns=None,include=True,str=None,detail=False,how='value',**correl_kwargs): """ how : string value pct_chg diff """ def _correl(df,periods=21,columns=None,include=True,str=None,detail=False,**correl_kwargs): study='CORREL' df,_df,col...
Returns def scattergeo(): """ Returns """ path=os.path.join(os.path.dirname(__file__), '../data/scattergeo.csv') df=pd.read_csv(path) del df['Unnamed: 0'] df['text'] = df['airport'] + ' ' + df['city'] + ', ' + df['state'] + ' ' + 'Arrivals: ' + df['cnt'].astype(str) df=df.rename(columns={'cnt':'z','long':'lon...
Returns def choropleth(): """ Returns """ path=os.path.join(os.path.dirname(__file__), '../data/choropleth.csv') df=pd.read_csv(path) del df['Unnamed: 0'] df['z']=[np.random.randint(0,100) for _ in range(len(df))] return df
Returns a DataFrame with the required format for a pie plot Parameters: ----------- n_labels : int Number of labels mode : string Format for each item 'abc' for alphabet columns 'stocks' for random stock names def pie(n_labels=5,mode=None): """ Returns a DataFrame with the required format for...
Returns a DataFrame with the required format for a scatter plot Parameters: ----------- n_categories : int Number of categories n : int Number of points for each category prefix : string Name for each category mode : string Format for each item 'abc' for alphabet columns 'stocks' for r...
Returns a DataFrame with the required format for a heatmap plot Parameters: ----------- n_x : int Number of x categories n_y : int Number of y categories def heatmap(n_x=5,n_y=10): """ Returns a DataFrame with the required format for a heatmap plot Parameters: ----------- n_x : int Number of...
Returns a DataFrame with the required format for a scatter (lines) plot Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace columns : [str] List of column names dateIndex : bool If True it will return a datetime index if False it will return a enu...
Returns a DataFrame with the required format for a bar plot Parameters: ----------- n : int Number of points for each trace n_categories : int Number of categories for each point prefix : string Name for each category columns : [str] List of column names mode : string Format for each item ...
Returns a DataFrame with the required format for a candlestick or ohlc plot df[['open','high','low','close']] Parameters: ----------- n : int Number of ohlc points def ohlc(n=100): """ Returns a DataFrame with the required format for a candlestick or ohlc plot df[['open','high','low','close']] Parame...
Returns a DataFrame with the required format for a candlestick or ohlc plot df[['open','high','low','close','volume'] Parameters: ----------- n : int Number of ohlc points def ohlcv(n=100): """ Returns a DataFrame with the required format for a candlestick or ohlc plot df[['open','high','low','close','...
Returns a DataFrame with the required format for a box plot Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace mode : string Format for each item 'abc' for alphabet columns 'stocks' for random stock names def box(n_traces=5,n=100,mode=None): ""...
Returns a DataFrame with the required format for a histogram plot Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace mode : string Format for each item 'abc' for alphabet columns 'stocks' for random stock names def histogram(n_traces=1,n=500,dis...
Returns a DataFrame with the required format for a distribution plot (distplot) Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace mode : string Format for each item 'abc' for alphabet columns 'stocks' for random stock names def distplot(n_trace...
Returns a DataFrame with the required format for a distribution plot (distplot) Parameters: ----------- n : int Number of points categories : bool or int If True, then a column with categories is added n_categories : int Number of categories def violin(n=500,dispersion=3,categories=True,n_categori...
Returns a DataFrame with the required format for a surface plot Parameters: ----------- n_x : int Number of points along the X axis n_y : int Number of points along the Y axis def surface(n_x=20,n_y=20): """ Returns a DataFrame with the required format for a surface plot Parameters: ----------- ...
Returns a DataFrame with the required format for a surface (sine wave) plot Parameters: ----------- n : int Ranges for X and Y axis (-n,n) n_y : int Size of increment along the axis def sinwave(n=4,inc=.25): """ Returns a DataFrame with the required format for a surface (sine wave) plot Parameters...
Returns a theme definition. To see the colors translated (hex) use cufflinks.getLayout(theme) instead. def getTheme(theme=None): """ Returns a theme definition. To see the colors translated (hex) use cufflinks.getLayout(theme) instead. """ if not theme: theme = auth.get_config_file()['theme'] if theme in...
Generates a plotly Layout Parameters: ----------- theme : string Layout Theme solar pearl white title : string Chart Title xTitle : string X Axis Title yTitle : string Y Axis Title zTitle : string Z Axis Title Applicable only for 3d charts barmode : string Mode when displ...
Generates an annotations object Parameters: ----------- df : DataFrame Original DataFrame of values annotations : dict or list Dictionary of annotations {x_point : text} or List of Plotly annotations def get_annotations(df,annotations,kind='lines',theme=None,**kwargs): """ Generates an annotati...
Strips a figure into multiple figures with a trace on each of them Parameters: ----------- figure : Figure Plotly Figure def strip_figures(figure): """ Strips a figure into multiple figures with a trace on each of them Parameters: ----------- figure : Figure Plotly Figure """ fig=[] for trace in f...
Generates a layout with the union of all properties of multiple figures' layouts Parameters: ----------- fig : list(Figures) List of Plotly Figures def get_base_layout(figs): """ Generates a layout with the union of all properties of multiple figures' layouts Parameters: ----------- fig : list(Figures...
Generates multiple Plotly figures for a given DataFrame Parameters: ----------- df : DataFrame Pandas DataFrame specs : list(dict) List of dictionaries with the properties of each figure. All properties avaialbe can be seen with help(cufflinks.pd.DataFrame.iplot) asList : boolean If True, the...
Generates a single Figure from a list of figures Parameters: ----------- figures : list(Figures) List of figures to be merged. def merge_figures(figures): """ Generates a single Figure from a list of figures Parameters: ----------- figures : list(Figures) List of figures to be merged. """ figure={}...
Generates a subplot view for a set of figures This is a wrapper for plotly.tools.make_subplots Parameters: ----------- figures : [Figures] List of Plotly Figures shape : (rows,cols) Tuple indicating the size of rows and columns If omitted then the layout is automatically set shared_xaxes : bool As...
Generates a subplot view for a set of figures Parameters: ----------- rows : int Number of rows cols : int Number of cols shared_xaxes : bool Assign shared x axes. If True, subplots in the same grid column have one common shared x-axis at the bottom of the gird. shared_yaxes : bool Assign s...
Displays a matrix with scatter plot for each pair of Series in the DataFrame. The diagonal shows a histogram for each of the Series Parameters: ----------- df : DataFrame Pandas DataFrame theme : string Theme to be used (if not the default) bins : int Number of bins to use for histogram color : st...
Sets the axis in which each trace should appear If the axis doesn't exist then a new axis is created Parameters: ----------- traces : list(str) List of trace names on : string The axis in which the traces should be placed. If this is not indicated then a new axis will be created side : string S...
Returns a plotly shape Parameters: ----------- kind : string Shape kind line rect circle x : float x values for the shape. This assumes x0=x1 x0 : float x0 value for the shape x1 : float x1 value for the shape y : float y values for the shape. This assumes y0=y1 y0 : floa...
Returns a range selector Reference: https://plot.ly/python/reference/#layout-xaxis-rangeselector Parameters: ----------- steps : string or list(string) Steps for the range Examples: ['1y','2 months','5 weeks','ytd','2mtd'] bgocolor : string or tuple(color,alpha) Background color Examples: ...
Display an [n, m] matrix of labels def view_label_matrix(L, colorbar=True): """Display an [n, m] matrix of labels""" L = L.todense() if sparse.issparse(L) else L plt.imshow(L, aspect="auto") plt.title("Label Matrix") if colorbar: labels = sorted(np.unique(np.asarray(L).reshape(-1, 1).squeez...
Display an [m, m] matrix of overlaps def view_overlaps(L, self_overlaps=False, normalize=True, colorbar=True): """Display an [m, m] matrix of overlaps""" L = L.todense() if sparse.issparse(L) else L G = _get_overlaps_matrix(L, normalize=normalize) if not self_overlaps: np.fill_diagonal(G, 0) #...
Display an [m, m] matrix of conflicts def view_conflicts(L, normalize=True, colorbar=True): """Display an [m, m] matrix of conflicts""" L = L.todense() if sparse.issparse(L) else L C = _get_conflicts_matrix(L, normalize=normalize) plt.imshow(C, aspect="auto") plt.title("Conflicts") if colorbar:...
Plot a histogram from a numpy array of probabilities Args: Y_p: An [n] or [n, 1] np.ndarray of probabilities (floats in [0,1]) def plot_probabilities_histogram(Y_p, title=None): """Plot a histogram from a numpy array of probabilities Args: Y_p: An [n] or [n, 1] np.ndarray of probabilities...
Plot a histogram comparing int predictions vs true labels by class Args: Y_ph: An [n] or [n, 1] np.ndarray of predicted int labels Y: An [n] or [n, 1] np.ndarray of gold labels def plot_predictions_histogram(Y_ph, Y, title=None): """Plot a histogram comparing int predictions vs true labels by ...
Given a set of int nodes i and edges (i,j), returns an nx.Graph object G which is a clique tree, where: - G.node[i]['members'] contains the set of original nodes in the ith maximal clique - G[i][j]['members'] contains the set of original nodes in the seperator set between max...
Returns True if the logging frequency has been met. def check(self, batch_size): """Returns True if the logging frequency has been met.""" self.increment(batch_size) return self.unit_count >= self.config["log_train_every"]
Update the total and relative unit counts def increment(self, batch_size): """Update the total and relative unit counts""" self.example_count += batch_size self.example_total += batch_size if self.log_unit == "seconds": self.unit_count = int(self.timer.elapsed()) ...
Add standard and custom metrics to metrics_dict def calculate_metrics(self, model, train_loader, valid_loader, metrics_dict): """Add standard and custom metrics to metrics_dict""" # Check whether or not it's time for validation as well self.log_count += 1 log_valid = ( valid...
Print calculated metrics and optionally write to file (json/tb) def log(self, metrics_dict): """Print calculated metrics and optionally write to file (json/tb)""" if self.writer: self.write_to_file(metrics_dict) if self.verbose: self.print_to_screen(metrics_dict) ...
Print all metrics in metrics_dict to screen def print_to_screen(self, metrics_dict): """Print all metrics in metrics_dict to screen""" score_strings = defaultdict(list) for split_metric, value in metrics_dict.items(): split, metric = split_metric.split("/", 1) if isinst...
Reduces the output of an LSTM step Args: outputs: (torch.FloatTensor) the hidden state outputs from the lstm, with shape [batch_size, max_seq_length, hidden_size] def _reduce_output(self, outputs, seq_lengths): """Reduces the output of an LSTM step Args: ...
Applies one step of an lstm (plus reduction) to the input X, which is handled by self.encoder def forward(self, X): """Applies one step of an lstm (plus reduction) to the input X, which is handled by self.encoder""" # Identify the first non-zero integer from the right (i.e., the length ...