This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hook(): | |
def __init__(self, m:nn.Module, hook_func:HookFunc, is_forward:bool=True, detach:bool=True): | |
self.hook_func,self.detach,self.stored = hook_func,detach,None | |
f = m.register_forward_hook if is_forward else m.register_backward_hook | |
self.hook = f(self.hook_fn) | |
self.removed = False | |
def hook_fn(self, module:nn.Module, input:Tensors, output:Tensors): | |
if self.detach: | |
input = (o.detach() for o in input ) if is_listy(input ) else input.detach() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
'uniq_id': 'b129a98c7c0e905ca82fd73db63d9bd0', | |
'product_url': 'http://www.flipkart.com/mario-gotze-women-s-printed-casual-orange-shirt/p/itmejrchnshfzygz?pid=SHTEJRCHC5KESPYX', | |
'product_name': "Mario Gotze Women's Printed Casual Orange Shirt", | |
'pid': 'SHTEJRCHC5KESPYX', | |
'retail_price': 1499.0, | |
'discounted_price': 899.0, | |
'image': 'http://img5a.flixcart.com/image/shirt/x/z/8/rrcls-w-6107-mario-gotze-xl-original-imaejqq4yqhsfepr.jpeg', | |
'description': "Key Features of Mario Gotze Women's Printed Casual Orange Shirt Fit: Slim Suitable For: Western Wear Sleeve: Full Sleeve Fabric: Cotton Color:Orange Pattern:Printed Number Of Contents In Package:1,Mario Gotze Women's Printed Casual Orange Shirt Price: Rs. 899 1 shirt,Specifications of Mario Gotze Women's Printed Casual Orange Shirt General Details Pattern Printed Ideal For Women's Occasion Casual Shirt Details Sleeve Full Sleeve Number of Contents in Sales Package Pack of 1 Brand Fit Slim Fabric Cotton Fit Slim Placket Classic Collar Additional Details St |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pypika import Table, Query | |
from pypika.terms import Function | |
class ToUnixtime(Function): | |
def __init__(self, input): | |
super(ToUnixtime, self).__init__('to_unixtime', input) | |
actions = Table('test.actions') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Add Widgets to A New Page | |
- Click on **Folders**, **New Folder** | |
- Enter a Folder Name and Click on **Create** | |
- In the newly created folder click on **Menu Icon** in the right corner and click on **add new trigger** | |
- Enter a name for the trigger, for example, assuming we are adding the widget to **Explore Page**, trigger name can be **Explore Page** | |
- Click on **Trigger Configuration** and select **DOM Ready** | |
- click on **Some DOM Ready Events** | |
- In the first option select **Page Path** from the drop down list | |
- In the second option select **contains** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>Preview the Widgets</h2> | |
- Click on **Preview** button | |
![enter image description here](http://i.imgur.com/Sd8D5Pe.png) | |
> If any steps were off-target in the process, you might face errors at this point. kindly contact us for further assistance. | |
- A Preview mode bar will appear in the dashboard | |
![enter image description here](http://i.imgur.com/shvJZx2.png) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>Changing the Display Position of Widget</h2> | |
- Click on **Folder**, and click on **Home Page** or **Product Page**, depending on the widget you want to change. | |
- Click on the **Menu** Icon in the top right corner and select **Add new Variable** | |
![enter image description here](http://i.imgur.com/LqDm0IN.png) | |
- Replace **Untitled Variable** with any **variable name** for example **Header Page Position 1**. (Keep Note of this **variable name** as it will be used again) Click on **Variable Configuration** | |
![enter image description here](http://i.imgur.com/wnwjKqD.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2> Creating a Customizable Widget Header </h2> | |
To add a customizable header to widget, follow the steps below. | |
- Click on **Folder**, **widget titles** | |
- Click on the **Menu** Icon in the top right corner and select **Add new Variable** | |
![enter image description here](http://i.imgur.com/Noqc7IL.png) | |
- Replace **Untitled Variable** with any **variable name** for example **Trending Products Header**. (Keep Note of this **variable name** as it will be used again) Click on **Variable Configuration** | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2> Adding Custom CSS for a Widget </h2> | |
To add a customizable header to widget, follow the steps below. | |
- Click on **Folder**, and click on **Home Page** or **Product Page**, depending on the widget you want to add CSS to. | |
- Click on the **Menu** Icon in the top right corner and select **Add new Tag** | |
![enter image description here](http://i.imgur.com/iOgfokt.png) | |
- In the Create Tag page replace **untitled tag** with any widget name.For Example **Trending Product CSS** And click on the **Tag Configuration** | |
![hpw](http://i.imgur.com/tATgb8b.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adding Your Own Widget | |
====================== | |
Any Product List created in the Yfret portal can be added as a custom widget to your site. | |
<h2>Creating a Product List</h2> | |
- Login to your **Yfret Portal**. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adding Custom Web Widgets Using Google Tag Manager | |
================================================== | |
Importing GTM scripts | |
--------------------- | |
To add custom widgets import the file provided into GTM by following these steps. | |
1. Login to your [google tag manager console](https://tagmanager.google.com/#/home) | |
2. Click on **Admin** tab | |
3. Click on **Import Container** |